Optimize peel_ref for the current ref of a for_each_ref callback
[gitweb.git] / builtin-read-tree.c
index 57854017535a36fc1fcd7bb997f198956391199d..7bdc312e3861103fa83b20b939962a8bc8e6cc0a 100644 (file)
@@ -41,11 +41,12 @@ static int read_cache_unmerged(void)
        for (i = 0; i < active_nr; i++) {
                struct cache_entry *ce = active_cache[i];
                if (ce_stage(ce)) {
+                       remove_index_entry(ce);
                        if (last && !strcmp(ce->name, last->name))
                                continue;
                        cache_tree_invalidate_path(active_cache_tree, ce->name);
                        last = ce;
-                       ce->ce_flags |= CE_REMOVE;
+                       continue;
                }
                *dst++ = ce;
        }