summaryrefslogtreecommitdiff
path: root/builtin-fetch-pack.c
diff options
context:
space:
mode:
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>2008-03-03 07:31:23 +0100
committerJunio C Hamano <gitster@pobox.com>2008-03-03 01:13:05 -0800
commitf3ec549481827b10609a43bf504517a0e8063a12 (patch)
treee4c8711d813bf36c7ca5f64915a683b0f6954f96 /builtin-fetch-pack.c
parent2d3539e87a75b5f93f9e53bf13a60ef67a28ea62 (diff)
downloadgit-f3ec549481827b10609a43bf504517a0e8063a12.tar.gz
fetch-pack: check parse_commit/object results
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fetch-pack.c')
-rw-r--r--builtin-fetch-pack.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index b23e886d75..29b38e4650 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -41,7 +41,8 @@ static void rev_list_push(struct commit *commit, int mark)
commit->object.flags |= mark;
if (!(commit->object.parsed))
- parse_commit(commit);
+ if (parse_commit(commit))
+ return;
insert_by_date(commit, &rev_list);
@@ -83,7 +84,8 @@ static void mark_common(struct commit *commit,
if (!ancestors_only && !(o->flags & POPPED))
non_common_revs--;
if (!o->parsed && !dont_parse)
- parse_commit(commit);
+ if (parse_commit(commit))
+ return;
for (parents = commit->parents;
parents;
@@ -103,20 +105,20 @@ static const unsigned char* get_rev(void)
while (commit == NULL) {
unsigned int mark;
- struct commit_list* parents;
+ struct commit_list *parents = NULL;
if (rev_list == NULL || non_common_revs == 0)
return NULL;
commit = rev_list->item;
if (!(commit->object.parsed))
- parse_commit(commit);
+ if (!parse_commit(commit))
+ parents = commit->parents;
+
commit->object.flags |= POPPED;
if (!(commit->object.flags & COMMON))
non_common_revs--;
- parents = commit->parents;
-
if (commit->object.flags & COMMON) {
/* do not send "have", and ignore ancestors */
commit = NULL;
@@ -212,7 +214,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
if (!lookup_object(sha1))
die("object not found: %s", line);
/* make sure that it is parsed as shallow */
- parse_object(sha1);
+ if (!parse_object(sha1))
+ die("error in object: %s", line);
if (unregister_shallow(sha1))
die("no shallow found: %s", line);
continue;