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>
Martin Koegler committed
Mar 3, 2008 at 07:31 UTC
f3ec549481827b10609a43bf504517a0e8063a12
1 file changed
+10
-7
builtin-fetch-pack.c
+10
-7
@@ -41,7 +41,8 @@ static void rev_list_push(struct commit *commit, int mark)
41
commit->object.flags |= mark;
42
43
if (!(commit->object.parsed))
44
- parse_commit(commit);
44
+ if (parse_commit(commit))
45
+ return;
46
47
insert_by_date(commit, &rev_list);
48
@@ -83,7 +84,8 @@ static void mark_common(struct commit *commit,
84
if (!ancestors_only && !(o->flags & POPPED))
85
non_common_revs--;
86
if (!o->parsed && !dont_parse)
86
- parse_commit(commit);
87
+ if (parse_commit(commit))
88
+ return;
89
90
for (parents = commit->parents;
91
parents;
@@ -103,20 +105,20 @@ static const unsigned char* get_rev(void)
105
106
while (commit == NULL) {
107
unsigned int mark;
106
- struct commit_list* parents;
108
+ struct commit_list *parents = NULL;
109
110
if (rev_list == NULL || non_common_revs == 0)
111
return NULL;
112
113
commit = rev_list->item;
114
if (!(commit->object.parsed))
113
- parse_commit(commit);
115
+ if (!parse_commit(commit))
116
+ parents = commit->parents;
117
+
118
commit->object.flags |= POPPED;
119
if (!(commit->object.flags & COMMON))
120
non_common_revs--;
121
118
- parents = commit->parents;
119
-
122
if (commit->object.flags & COMMON) {
123
/* do not send "have", and ignore ancestors */
124
commit = NULL;
@@ -212,7 +214,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
214
if (!lookup_object(sha1))
215
die("object not found: %s", line);
216
/* make sure that it is parsed as shallow */
215
- parse_object(sha1);
217
+ if (!parse_object(sha1))
218
+ die("error in object: %s", line);
219
if (unregister_shallow(sha1))
220
die("no shallow found: %s", line);
221
continue;