From: Jonas Fonseca <fonseca@diku.dk>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] git-fsck-cache: Gracefully handle non-commit IDs
Date: Sat, 30 Apr 2005 02:28:09 +0200 [thread overview]
Message-ID: <20050430002809.GB32339@diku.dk> (raw)
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
reply other threads:[~2005-04-30 0:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050430002809.GB32339@diku.dk \
--to=fonseca@diku.dk \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox