From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH] parse_commit: don't ignore NULL from loopup_commit
Date: Thu, 14 Feb 2008 23:02:01 +0100 [thread overview]
Message-ID: <12030265212108-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
This behaviour causes a different parent list depending on
the already loaded objects, if the parent points contains
a non commit sha1.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
This will hide such an error from fsck (as the parent is not
returned) and make it only print a message to stderr.
commit.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/commit.c b/commit.c
index 8b8fb04..116afb7 100644
--- a/commit.c
+++ b/commit.c
@@ -275,7 +275,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
if (new_parent) {
pptr = &commit_list_insert(new_parent, pptr)->next;
n_refs++;
- }
+ } else
+ return error("bad parents in commit %s", sha1_to_hex(item->object.sha1));
}
if (graft) {
int i;
@@ -283,7 +284,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
for (i = 0; i < graft->nr_parent; i++) {
new_parent = lookup_commit(graft->parent[i]);
if (!new_parent)
- continue;
+ return error("bad graft in commit %s", sha1_to_hex(item->object.sha1));
pptr = &commit_list_insert(new_parent, pptr)->next;
n_refs++;
}
--
1.5.4.1.g3a858
reply other threads:[~2008-02-14 22:02 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=12030265212108-git-send-email-mkoegler@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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;
as well as URLs for NNTP newsgroup(s).