- struct cache_entry **dst = src;
- struct cache_entry *old = NULL;
-
- while (nr--) {
- struct cache_entry *ce, *result;
-
- ce = *src++;
-
- /* We throw away original cache entries except for the stat information */
- if (!ce_stage(ce)) {
- if (old)
- reject_merge(old);
- old = ce;
- active_nr--;
- continue;
- }
- if (old && !path_matches(old, ce))
- reject_merge(old);
- if (nr > 1 && (result = merge_entries(ce, src[0], src[1])) != NULL) {
- result->ce_flags |= htons(CE_UPDATE);
- /*
- * See if we can re-use the old CE directly?
- * That way we get the uptodate stat info.
- *
- * This also removes the UPDATE flag on
- * a match.
- */
- if (old && same(old, result)) {
- *result = *old;
- old = NULL;
- }
- CHECK_OLD(ce);
- CHECK_OLD(src[0]);
- CHECK_OLD(src[1]);
- ce = result;
- ce->ce_flags &= ~htons(CE_STAGEMASK);
- src += 2;
- nr -= 2;
- active_nr -= 2;
- }
-