Skip to content

Commit

Permalink
Ignore '\r' at the end of line in $GIT_DIR/config
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 3, 2005
1 parent d317e43 commit db2c075
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.c
Expand Up @@ -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) {
Expand Down

0 comments on commit db2c075

Please sign in to comment.