From db2c075d9375a32b8010d2b17c1d420aa8696710 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 13:02:57 -0800 Subject: [PATCH] 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 --- config.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config.c b/config.c index 519fecfe..e89bab26 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) { -- 2.11.0