t5520: check reflog action in fast-forward merge
[gitweb.git] / cache-tree.c
index 75a54fdc7232e5693b042aa06540d51a99f01551..32772b95644d2f32841984b25b685379c6914ad4 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "lockfile.h"
 #include "tree.h"
 #include "tree-walk.h"
 #include "cache-tree.h"
@@ -302,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;