From 3f163962282d2d8bea914c32d81ad38544044f78 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 28 Oct 2015 13:29:24 -0700 Subject: clone/sha1_file: read info/alternates with strbuf_getline() $GIT_OBJECT_DIRECTORY/info/alternates is a text file that can be edited with a DOS editor. We do not want to use the real path with CR appended at the end. Signed-off-by: Junio C Hamano diff --git a/builtin/clone.c b/builtin/clone.c index 29741f4..43b4c99 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -339,7 +339,7 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst, FILE *in = fopen(src->buf, "r"); struct strbuf line = STRBUF_INIT; - while (strbuf_getline_lf(&line, in) != EOF) { + while (strbuf_getline(&line, in) != EOF) { char *abs_path; if (!line.len || line.buf[0] == '#') continue; diff --git a/sha1_file.c b/sha1_file.c index 86b5e8c..aab1872 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -396,7 +396,7 @@ void add_to_alternates_file(const char *reference) struct strbuf line = STRBUF_INIT; int found = 0; - while (strbuf_getline_lf(&line, in) != EOF) { + while (strbuf_getline(&line, in) != EOF) { if (!strcmp(reference, line.buf)) { found = 1; break; -- cgit v0.10.2-6-g49f6