aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-16 14:24:56 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-16 14:24:56 -0700
commit5bc4ce589646faf72c7a77a5d32d9496ccc8d456 (patch)
treeccd388a1e05223b96675d51d37a1f2db9df5ee94
parent402461aab17292b78bd36a17bff18e48d544cc9a (diff)
downloadgit-5bc4ce589646faf72c7a77a5d32d9496ccc8d456.tar.gz
git-5bc4ce589646faf72c7a77a5d32d9496ccc8d456.tar.xz
reading $GIT_DIR/info/graft - skip comments correctly.
Noticed by Yann Dirson. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--commit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index ca2557450..05c4c923f 100644
--- a/commit.c
+++ b/commit.c
@@ -161,7 +161,7 @@ struct commit_graft *read_graft_line(char *buf, int len)
if (buf[len-1] == '\n')
buf[--len] = 0;
if (buf[0] == '#')
- return 0;
+ return NULL;
if ((len + 1) % 41) {
bad_graft_data:
error("bad graft data: %s", buf);
@@ -192,6 +192,8 @@ int read_graft_file(const char *graft_file)
/* The format is just "Commit Parent1 Parent2 ...\n" */
int len = strlen(buf);
struct commit_graft *graft = read_graft_line(buf, len);
+ if (!graft)
+ continue;
if (register_commit_graft(graft, 1))
error("duplicate graft data: %s", buf);
}