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 <gitster@pobox.com>

Junio C Hamano committed Oct 28, 2015 at 13:29 UTC 3f163962282d2d8bea914c32d81ad38544044f78
2 files changed +2 -2
builtin/clone.c
+1 -1
@@ -339,7 +339,7 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
339 FILE *in = fopen(src->buf, "r");
340 struct strbuf line = STRBUF_INIT;
341
342 - while (strbuf_getline_lf(&line, in) != EOF) {
342 + while (strbuf_getline(&line, in) != EOF) {
343 char *abs_path;
344 if (!line.len || line.buf[0] == '#')
345 continue;
sha1_file.c
+1 -1
@@ -396,7 +396,7 @@ void add_to_alternates_file(const char *reference)
396 struct strbuf line = STRBUF_INIT;
397 int found = 0;
398
399 - while (strbuf_getline_lf(&line, in) != EOF) {
399 + while (strbuf_getline(&line, in) != EOF) {
400 if (!strcmp(reference, line.buf)) {
401 found = 1;
402 break;