Skip to content

Commit 5bc4ce5

Browse files
author
Junio C Hamano
committed
reading $GIT_DIR/info/graft - skip comments correctly.
Noticed by Yann Dirson. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 402461a commit 5bc4ce5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

commit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct commit_graft *read_graft_line(char *buf, int len)
161161
if (buf[len-1] == '\n')
162162
buf[--len] = 0;
163163
if (buf[0] == '#')
164-
return 0;
164+
return NULL;
165165
if ((len + 1) % 41) {
166166
bad_graft_data:
167167
error("bad graft data: %s", buf);
@@ -192,6 +192,8 @@ int read_graft_file(const char *graft_file)
192192
/* The format is just "Commit Parent1 Parent2 ...\n" */
193193
int len = strlen(buf);
194194
struct commit_graft *graft = read_graft_line(buf, len);
195+
if (!graft)
196+
continue;
195197
if (register_commit_graft(graft, 1))
196198
error("duplicate graft data: %s", buf);
197199
}

0 commit comments

Comments
 (0)