{"thread":{"id":"12106","subject":"[PATCH] parse_commit: don't ignore NULL from loopup_commit","startedAt":"2008-02-14T22:02:01Z","lastAt":"2008-02-14T22:02:01Z","messageCount":1,"participants":["Martin Koegler"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"68775","messageId":"12030265212108-git-send-email-mkoegler@auto.tuwien.ac.at","threadId":"12106","inReplyTo":null,"subject":"[PATCH] parse_commit: don't ignore NULL from loopup_commit","fromName":"Martin Koegler","fromEmail":"mkoegler@auto.tuwien.ac.at","sentAt":"2008-02-14T22:02:01Z","receivedAt":"2008-02-14T22:02:01Z","isPatch":true,"sender":{"key":"mkoegler@auto.tuwien.ac.at","avatar":null},"body":"This behaviour causes a different parent list depending on\nthe already loaded objects, if the parent points contains\na non commit sha1.\n\nSigned-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>\n---\nThis will hide such an error from fsck (as the parent is not\nreturned) and make it only print a message to stderr.\n\n commit.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex 8b8fb04..116afb7 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -275,7 +275,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)\n \t\tif (new_parent) {\n \t\t\tpptr = &commit_list_insert(new_parent, pptr)->next;\n \t\t\tn_refs++;\n-\t\t}\n+\t\t} else\n+\t\t\treturn error(\"bad parents in commit %s\", sha1_to_hex(item->object.sha1));\n \t}\n \tif (graft) {\n \t\tint i;\n@@ -283,7 +284,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)\n \t\tfor (i = 0; i < graft->nr_parent; i++) {\n \t\t\tnew_parent = lookup_commit(graft->parent[i]);\n \t\t\tif (!new_parent)\n-\t\t\t\tcontinue;\n+\t\t\t\treturn error(\"bad graft in commit %s\", sha1_to_hex(item->object.sha1));\n \t\t\tpptr = &commit_list_insert(new_parent, pptr)->next;\n \t\t\tn_refs++;\n \t\t}\n-- \n1.5.4.1.g3a858\n"}]}