@matheusbsbs / matheus-bagliano / commits / 4e363b11bd
Fork 0

Revert "unpack_trees(): skip trees that are the same in all input"

This reverts commit 83c90314aa27ae3768c04375d02e4f3fb12b726d, which seems to have broken merge to report conflicts when there should be none.

Junio C Hamano committed Feb 15, 2011 at 10:47 UTC 4e363b11bdc3770efcfe55dac79f6dc18a5e562b
1 file changed -56
unpack-trees.c
-56
@@ -427,10 +427,6 @@ static int switch_cache_bottom(struct traverse_info *info)
427 return ret;
428 }
429
430 -static int fast_forward_merge(int n, unsigned long dirmask,
431 - struct name_entry *names,
432 - struct traverse_info *info);
433 -
430 static int traverse_trees_recursive(int n, unsigned long dirmask,
431 unsigned long df_conflicts,
432 struct name_entry *names,
@@ -442,11 +438,6 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
438 struct traverse_info newinfo;
439 struct name_entry *p;
440
445 - if (!df_conflicts) {
446 - int status = fast_forward_merge(n, dirmask, names, info);
447 - if (status)
448 - return status;
449 - }
441 p = names;
442 while (!p->mode)
443 p++;
@@ -694,53 +685,6 @@ static struct cache_entry *find_cache_entry(struct traverse_info *info,
685 return NULL;
686 }
687
697 -static int fast_forward_merge(int n, unsigned long dirmask,
698 - struct name_entry *names,
699 - struct traverse_info *info)
700 -{
701 - int i;
702 - struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
703 - struct unpack_trees_options *o = info->data;
704 -
705 - /* merging two or more trees with an identical subdirectory? */
706 - if ((n < 2) || ((1UL << n) - 1) != dirmask ||
707 - !o->merge || o->reset || o->initial_checkout)
708 - return 0;
709 - for (i = 1; i < n; i++)
710 - if (hashcmp(names[i-1].sha1, names[i].sha1))
711 - return 0;
712 -
713 - /*
714 - * Instead of descending into the directory, keep the contents
715 - * of the current index.
716 - */
717 - while (1) {
718 - struct cache_entry *ce;
719 - ce = next_cache_entry(o);
720 - if (!ce)
721 - break;
722 - /* Is the entry still in that directory? */
723 - if (do_compare_entry(ce, info, names))
724 - break;
725 - /*
726 - * Note: we do not just run unpack_index_entry() here,
727 - * as the callback may want to compare what is in the
728 - * index with what are from the HEAD and the other tree
729 - * and reject the merge. We pretend that ancestors, the
730 - * HEAD and the other tree all have the same contents as
731 - * the current index, which is a lie, but it works.
732 - */
733 - for (i = 0; i < n + 1; i++)
734 - src[i] = ce;
735 - mark_ce_used(ce, o);
736 - if (call_unpack_fn(src, o) < 0)
737 - return unpack_failed(o, NULL);
738 - if (ce_stage(ce))
739 - mark_ce_used_same_name(ce, o);
740 - }
741 - return dirmask;
742 -}
743 -
688 static void debug_path(struct traverse_info *info)
689 {
690 if (info->prev) {