diff-index: keep the original index intact
When comparing the index and a tree, we used to read the contents of the tree into stage #1 of the index and compared them with stage #0. In order not to lose sight of entries originally unmerged in the index, we hoisted them to stage #3 before reading the tree. Commit d1f2d7e (Make run_diff_index() use unpack_trees(), not read_tree(), 2008-01-19) changed all this. These days, we instead use unpack_trees() API to traverse the tree and compare the contents with the index, without modifying the index at all. There is no reason to hoist the unmerged entries to stage #3 anymore. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 4, 2009 at 22:08 UTC
26da1d78674204c482ec90905dd4de3f6bcd3c5f
1 file changed
-18
diff-lib.c
-18
@@ -308,22 +308,6 @@ static int show_modified(struct rev_info *revs,
308
return 0;
309
}
310
311
-/*
312
- * This turns all merge entries into "stage 3". That guarantees that
313
- * when we read in the new tree (into "stage 1"), we won't lose sight
314
- * of the fact that we had unmerged entries.
315
- */
316
-static void mark_merge_entries(void)
317
-{
318
- int i;
319
- for (i = 0; i < active_nr; i++) {
320
- struct cache_entry *ce = active_cache[i];
321
- if (!ce_stage(ce))
322
- continue;
323
- ce->ce_flags |= CE_STAGEMASK;
324
- }
325
-}
326
-
311
/*
312
* This gets a mix of an existing index and a tree, one pathname entry
313
* at a time. The index entry may be a single stage-0 one, but it could
@@ -435,8 +419,6 @@ int run_diff_index(struct rev_info *revs, int cached)
419
struct unpack_trees_options opts;
420
struct tree_desc t;
421
438
- mark_merge_entries();
439
-
422
ent = revs->pending.objects[0].item;
423
tree_name = revs->pending.objects[0].name;
424
tree = parse_tree_indirect(ent->sha1);