summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-11-02 13:02:57 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2005-11-02 16:50:58 -0800
commitdb2c075d9375a32b8010d2b17c1d420aa8696710 (patch)
tree2ec5549cac0b8a08c1d4303e34b8fb21224f9a1f /config.c
parentremove CR/LF from .gitignore (diff)
downloadtgif-db2c075d9375a32b8010d2b17c1d420aa8696710.tar.xz
Ignore '\r' at the end of line in $GIT_DIR/config
Unfortunate people may have to use $GIT_DIR/config edited on DOSsy machine on UNIXy machine. Ignore '\r' immediately followed by '\n'. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'config.c')
-rw-r--r--config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.c b/config.c
index 519fecfee4..e89bab26c9 100644
--- a/config.c
+++ b/config.c
@@ -13,6 +13,14 @@ static int get_next_char(void)
c = '\n';
if ((f = config_file) != NULL) {
c = fgetc(f);
+ if (c == '\r') {
+ /* DOS like systems */
+ c = fgetc(f);
+ if (c != '\n') {
+ ungetc(c, f);
+ c = '\r';
+ }
+ }
if (c == '\n')
config_linenr++;
if (c == EOF) {