X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=shallow.c;h=4d90eda19efe0a80c1cb39e8897ab3ed5e6fcf56;hb=41fa7d2eaeace0c5c23fc75a3d5cc9efbad467a5;hp=3d53d17423a73a1e206ee631c33ec7a88c40707a;hpb=3bd5c81e0243e4ff391b38b31ef237e46eca257b;p=git.git diff --git a/shallow.c b/shallow.c index 3d53d1742..4d90eda19 100644 --- a/shallow.c +++ b/shallow.c @@ -17,7 +17,7 @@ int register_shallow(const unsigned char *sha1) return register_commit_graft(graft, 0); } -int is_repository_shallow() +int is_repository_shallow(void) { FILE *fp; char buf[1024]; @@ -56,7 +56,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, if (i < heads->nr) { commit = (struct commit *) deref_tag(heads->objects[i++].item, NULL, 0); - if (commit->object.type != OBJ_COMMIT) { + if (!commit || commit->object.type != OBJ_COMMIT) { commit = NULL; continue; } @@ -70,7 +70,8 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, cur_depth = *(int *)commit->util; } } - parse_commit(commit); + if (parse_commit(commit)) + die("invalid commit"); commit->object.flags |= not_shallow_flag; cur_depth++; for (p = commit->parents, commit = NULL; p; p = p->next) { @@ -101,4 +102,3 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth, return result; } -