reading $GIT_DIR/info/graft - skip comments correctly.
Noticed by Yann Dirson. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Apr 16, 2006 at 14:24 UTC
5bc4ce589646faf72c7a77a5d32d9496ccc8d456
1 file changed
+3
-1
commit.c
+3
-1
@@ -161,7 +161,7 @@ struct commit_graft *read_graft_line(char *buf, int len)
161
if (buf[len-1] == '\n')
162
buf[--len] = 0;
163
if (buf[0] == '#')
164
- return 0;
164
+ return NULL;
165
if ((len + 1) % 41) {
166
bad_graft_data:
167
error("bad graft data: %s", buf);
@@ -192,6 +192,8 @@ int read_graft_file(const char *graft_file)
192
/* The format is just "Commit Parent1 Parent2 ...\n" */
193
int len = strlen(buf);
194
struct commit_graft *graft = read_graft_line(buf, len);
195
+ if (!graft)
196
+ continue;
197
if (register_commit_graft(graft, 1))
198
error("duplicate graft data: %s", buf);
199
}