Catch errors when writing an index that contains invalid objects.

If git-write-index is called without --missing-ok, it reports invalid
objects that it finds in the index. But without this patch it dies
right away or may run into an infinite loop.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Johannes Sixt
2006-11-13 13:50:00 +00:00
committed by Junio C Hamano
parent 40cf043389
commit 3d12d0cfbb
2 changed files with 24 additions and 0 deletions

View File

@ -282,6 +282,8 @@ static int update_one(struct cache_tree *it,
baselen + sublen + 1,
missing_ok,
dryrun);
if (subcnt < 0)
return subcnt;
i += subcnt - 1;
sub->used = 1;
}