Merge branch 'jk/cache-tree-protect-from-broken-libgit2'

The code to use cache-tree trusted the on-disk data too much
and fell into an infinite loop.

* jk/cache-tree-protect-from-broken-libgit2:
  cache-tree: avoid infinite loop on zero-entry tree
This commit is contained in:
Junio C Hamano 2014-11-06 10:51:35 -08:00
commit e44da1bbb8

View File

@ -303,6 +303,8 @@ static int update_one(struct cache_tree *it,
flags);
if (subcnt < 0)
return subcnt;
if (!subcnt)
die("index cache-tree records empty sub-tree");
i += subcnt;
sub->count = subcnt; /* to be used in the next loop */
*skip_count += subskip;