Skip to content

Commit 4e363b1

Browse files
committed
Revert "unpack_trees(): skip trees that are the same in all input"
This reverts commit 83c9031, which seems to have broken merge to report conflicts when there should be none.
1 parent 3952710 commit 4e363b1

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

unpack-trees.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ static int switch_cache_bottom(struct traverse_info *info)
427427
return ret;
428428
}
429429

430-
static int fast_forward_merge(int n, unsigned long dirmask,
431-
struct name_entry *names,
432-
struct traverse_info *info);
433-
434430
static int traverse_trees_recursive(int n, unsigned long dirmask,
435431
unsigned long df_conflicts,
436432
struct name_entry *names,
@@ -442,11 +438,6 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
442438
struct traverse_info newinfo;
443439
struct name_entry *p;
444440

445-
if (!df_conflicts) {
446-
int status = fast_forward_merge(n, dirmask, names, info);
447-
if (status)
448-
return status;
449-
}
450441
p = names;
451442
while (!p->mode)
452443
p++;
@@ -694,53 +685,6 @@ static struct cache_entry *find_cache_entry(struct traverse_info *info,
694685
return NULL;
695686
}
696687

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-
744688
static void debug_path(struct traverse_info *info)
745689
{
746690
if (info->prev) {

0 commit comments

Comments
 (0)