Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
[PATCH] git-fsck-cache: Gracefully handle non-commit IDs
author
Jonas Fonseca
<fonseca@diku.dk>
Sat, 30 Apr 2005 03:00:40 +0000
(20:00 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Sat, 30 Apr 2005 03:00:40 +0000
(20:00 -0700)
Gracefully handle non-commit IDs instead of segfaulting.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fsck-cache.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
87fec8f
)
diff --git
a/fsck-cache.c
b/fsck-cache.c
index 280a104050b665515418c00c33af8e6b0b0e2101..164fc2eaeeac42a5bbec45845d852da8104e2459 100644
(file)
--- a/
fsck-cache.c
+++ b/
fsck-cache.c
@@
-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++;