* [PATCH] git-fsck-cache: Gracefully handle non-commit IDs
@ 2005-04-30 0:28 Jonas Fonseca
0 siblings, 0 replies; only message in thread
From: Jonas Fonseca @ 2005-04-30 0:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
Gracefully handle non-commit IDs instead of segfaulting.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
--- 09465be469eef9711e93b583f4cd1092baa58f90/fsck-cache.c (mode:100644 sha1:280a104050b665515418c00c33af8e6b0b0e2101)
+++ uncommitted/fsck-cache.c (mode:100644)
@@ -174,7 +216,14 @@
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++;
--
Jonas Fonseca
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-30 0:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-30 0:28 [PATCH] git-fsck-cache: Gracefully handle non-commit IDs Jonas Fonseca
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox