]> git.ipfire.org Git - thirdparty/git.git/commitdiff
clone/sha1_file: read info/alternates with strbuf_getline()
authorJunio C Hamano <gitster@pobox.com>
Wed, 28 Oct 2015 20:29:24 +0000 (13:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Jan 2016 18:34:53 +0000 (10:34 -0800)
$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 <gitster@pobox.com>
builtin/clone.c
sha1_file.c

index 29741f44460a6648557ffe4619e71ca64cef3e63..43b4c99b67fc454fdadf8d10d1298041c8c4e6a7 100644 (file)
@@ -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;
index 86b5e8cf724a771e1b18630793a3ff488c904bbc..aab1872b4c95416fc7c8ae9c93cd25f341e2d4c1 100644 (file)
@@ -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;