summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-02 21:02:57 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-03 00:50:58 (GMT)
commitdb2c075d9375a32b8010d2b17c1d420aa8696710 (patch)
tree2ec5549cac0b8a08c1d4303e34b8fb21224f9a1f
parentd317e4384acd5646f2ba44197a531c129b26b57e (diff)
downloadgit-db2c075d9375a32b8010d2b17c1d420aa8696710.zip
git-db2c075d9375a32b8010d2b17c1d420aa8696710.tar.gz
git-db2c075d9375a32b8010d2b17c1d420aa8696710.tar.bz2
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>
-rw-r--r--config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/config.c b/config.c
index 519fecf..e89bab2 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) {