From: Junio C Hamano Date: Wed, 2 Nov 2005 21:02:57 +0000 (-0800) Subject: Ignore '\r' at the end of line in $GIT_DIR/config X-Git-Tag: v0.99.9c^2~9 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=db2c075d9375a32b8010d2b17c1d420aa8696710;p=git.git 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 --- 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) {