Commits

Junio C Hamano  committed db2c075

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>

  • Participants
  • Parent commits d317e43

Comments (0)

Files changed (1)

 	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) {