提交 e1a1388d 编写于 作者: J Jonas Fonseca 提交者: Linus Torvalds

[PATCH] git-fsck-cache: Gracefully handle non-commit IDs

Gracefully handle non-commit IDs instead of segfaulting.
Signed-off-by: NJonas Fonseca <fonseca@diku.dk>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 87fec8fc
......@@ -174,7 +174,14 @@ int main(int argc, char **argv)
continue;
if (!get_sha1_hex(arg, head_sha1)) {
struct object *obj = &lookup_commit(head_sha1)->object;
struct commit *commit = lookup_commit(head_sha1);
struct object *obj;
/* Error is printed by lookup_commit(). */
if (!commit)
continue;
obj = &commit->object;
obj->used = 1;
mark_reachable(obj, REACHABLE);
heads++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册