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>
This commit is contained in:
parent
d317e4384a
commit
db2c075d93
8
config.c
8
config.c
@ -13,6 +13,14 @@ static int get_next_char(void)
|
|||||||
c = '\n';
|
c = '\n';
|
||||||
if ((f = config_file) != NULL) {
|
if ((f = config_file) != NULL) {
|
||||||
c = fgetc(f);
|
c = fgetc(f);
|
||||||
|
if (c == '\r') {
|
||||||
|
/* DOS like systems */
|
||||||
|
c = fgetc(f);
|
||||||
|
if (c != '\n') {
|
||||||
|
ungetc(c, f);
|
||||||
|
c = '\r';
|
||||||
|
}
|
||||||
|
}
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
config_linenr++;
|
config_linenr++;
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user