{"thread":{"id":"402","subject":"[PATCH] git-fsck-cache: Gracefully handle non-commit IDs","startedAt":"2005-04-30T00:28:09Z","lastAt":"2005-04-30T00:28:09Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2222","messageId":"20050430002809.GB32339@diku.dk","threadId":"402","inReplyTo":null,"subject":"[PATCH] git-fsck-cache: Gracefully handle non-commit IDs","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-04-30T00:28:09Z","receivedAt":"2005-04-30T00:28:09Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Gracefully handle non-commit IDs instead of segfaulting.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n--- 09465be469eef9711e93b583f4cd1092baa58f90/fsck-cache.c  (mode:100644 sha1:280a104050b665515418c00c33af8e6b0b0e2101)\n+++ uncommitted/fsck-cache.c  (mode:100644)\n@@ -174,7 +216,14 @@\n \t\t\tcontinue;\n \n \t\tif (!get_sha1_hex(arg, head_sha1)) {\n-\t\t\tstruct object *obj = &lookup_commit(head_sha1)->object;\n+\t\t\tstruct commit *commit = lookup_commit(head_sha1);\n+\t\t\tstruct object *obj;\n+\n+\t\t\t/* Error is printed by lookup_commit(). */\n+\t\t\tif (!commit)\n+\t\t\t\tcontinue;\n+\n+\t\t\tobj = &commit->object;\n \t\t\tobj->used = 1;\n \t\t\tmark_reachable(obj, REACHABLE);\n \t\t\theads++;\n-- \nJonas Fonseca\n"}]}