summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-28 13:29:24 -0700
committerJunio C Hamano <gitster@pobox.com>2016-01-14 15:10:53 -0800
commit3708cb481ed9b97c464a717ccc49fd95e4ada0a3 (patch)
tree5f3691295547dc13637f675c918194b2ae608da3
parentec9d83d56c696b21f5450a2a6bbd181807767c20 (diff)
downloadgit-3708cb481ed9b97c464a717ccc49fd95e4ada0a3.tar.gz
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 appeneded at the end. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/clone.c2
-rw-r--r--sha1_file.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 29741f4446..43b4c99b67 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 86b5e8cf72..aab1872b4c 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;