Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit a5acb98

Browse files
committed
Merge 'unlimited-grafts' into HEAD
2 parents cd3b115 + a4fa3c5 commit a5acb98

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

builtin/blame.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,17 +1804,17 @@ static int prepare_lines(struct scoreboard *sb)
18041804
static int read_ancestry(const char *graft_file)
18051805
{
18061806
FILE *fp = fopen(graft_file, "r");
1807-
char buf[1024];
1807+
struct strbuf buf = STRBUF_INIT;
18081808
if (!fp)
18091809
return -1;
1810-
while (fgets(buf, sizeof(buf), fp)) {
1810+
while (!strbuf_getwholeline(&buf, fp, '\n')) {
18111811
/* The format is just "Commit Parent1 Parent2 ...\n" */
1812-
int len = strlen(buf);
1813-
struct commit_graft *graft = read_graft_line(buf, len);
1812+
struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
18141813
if (graft)
18151814
register_commit_graft(graft, 0);
18161815
}
18171816
fclose(fp);
1817+
strbuf_release(&buf);
18181818
return 0;
18191819
}
18201820

commit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,19 @@ struct commit_graft *read_graft_line(char *buf, int len)
196196
static int read_graft_file(const char *graft_file)
197197
{
198198
FILE *fp = fopen(graft_file, "r");
199-
char buf[1024];
199+
struct strbuf buf = STRBUF_INIT;
200200
if (!fp)
201201
return -1;
202-
while (fgets(buf, sizeof(buf), fp)) {
202+
while (!strbuf_getwholeline(&buf, fp, '\n')) {
203203
/* The format is just "Commit Parent1 Parent2 ...\n" */
204-
int len = strlen(buf);
205-
struct commit_graft *graft = read_graft_line(buf, len);
204+
struct commit_graft *graft = read_graft_line(buf.buf, buf.len);
206205
if (!graft)
207206
continue;
208207
if (register_commit_graft(graft, 1))
209-
error("duplicate graft data: %s", buf);
208+
error("duplicate graft data: %s", buf.buf);
210209
}
211210
fclose(fp);
211+
strbuf_release(&buf);
212212
return 0;
213213
}
214214

0 commit comments

Comments
 (0)