+ while (nr--) {
+ struct cache_entry *ce = *src++;
+ int stage = ce_stage(ce);
+
+ switch (stage) {
+ case 0:
+ if (old)
+ reject_merge(old);
+ old = ce;
+ stat = ce;
+ active_nr--;
+ continue;
+
+ case 1:
+ active_nr--;
+ if (!old)
+ continue;
+ if (!path_matches(old, ce) || !same(old, ce))
+ reject_merge(old);
+ continue;
+
+ case 2:
+ ce->ce_flags |= htons(CE_UPDATE);
+ if (old) {
+ if (!path_matches(old, ce))
+ reject_merge(old);
+ /*
+ * This also removes the UPDATE flag on
+ * a match
+ */
+ if (same(old, ce))
+ *ce = *old;
+ else
+ verify_uptodate(old);
+ old = NULL;
+ }
+ ce->ce_flags &= ~htons(CE_STAGEMASK);
+ *dst++ = ce;
+ continue;
+ }
+ die("impossible two-way stage");
+ }
+ if (old)
+ reject_merge(old);
+}
+
+static void merge_stat_info(struct cache_entry **src, int nr)
+{
+ static struct cache_entry null_entry;
+ struct cache_entry **dst = src;
+ struct cache_entry *stat = &null_entry;