Skip to content

Commit 3f16396

Browse files
committed
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 <[email protected]>
1 parent 18814d0 commit 3f16396

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
339339
FILE *in = fopen(src->buf, "r");
340340
struct strbuf line = STRBUF_INIT;
341341

342-
while (strbuf_getline_lf(&line, in) != EOF) {
342+
while (strbuf_getline(&line, in) != EOF) {
343343
char *abs_path;
344344
if (!line.len || line.buf[0] == '#')
345345
continue;

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void add_to_alternates_file(const char *reference)
396396
struct strbuf line = STRBUF_INIT;
397397
int found = 0;
398398

399-
while (strbuf_getline_lf(&line, in) != EOF) {
399+
while (strbuf_getline(&line, in) != EOF) {
400400
if (!strcmp(reference, line.buf)) {
401401
found = 1;
402402
break;

0 commit comments

Comments
 (0)