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>
Junio C Hamano committed
Nov 2, 2005 at 13:02 UTC
db2c075d9375a32b8010d2b17c1d420aa8696710
1 file changed
+8
config.c
+8
@@ -13,6 +13,14 @@ static int get_next_char(void)
13
c = '\n';
14
if ((f = config_file) != NULL) {
15
c = fgetc(f);
16
+ if (c == '\r') {
17
+ /* DOS like systems */
18
+ c = fgetc(f);
19
+ if (c != '\n') {
20
+ ungetc(c, f);
21
+ c = '\r';
22
+ }
23
+ }
24
if (c == '\n')
25
config_linenr++;
26
if (c == EOF) {