merge-ort: support subtree shifting
merge-recursive has some simple code to support subtree shifting; copy it over to merge-ort. This fixes t6409.12 under GIT_TEST_MERGE_ALGORITHM=ort. Signed-off-by: Elijah Newren <newren@gmail.com> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3860220bfa
commit
3639dfb3a8
24
merge-ort.c
24
merge-ort.c
@ -3551,6 +3551,23 @@ void merge_finalize(struct merge_options *opt,
|
||||
|
||||
/*** Function Grouping: helper functions for merge_incore_*() ***/
|
||||
|
||||
static struct tree *shift_tree_object(struct repository *repo,
|
||||
struct tree *one, struct tree *two,
|
||||
const char *subtree_shift)
|
||||
{
|
||||
struct object_id shifted;
|
||||
|
||||
if (!*subtree_shift) {
|
||||
shift_tree(repo, &one->object.oid, &two->object.oid, &shifted, 0);
|
||||
} else {
|
||||
shift_tree_by(repo, &one->object.oid, &two->object.oid, &shifted,
|
||||
subtree_shift);
|
||||
}
|
||||
if (oideq(&two->object.oid, &shifted))
|
||||
return two;
|
||||
return lookup_tree(repo, &shifted);
|
||||
}
|
||||
|
||||
static inline void set_commit_tree(struct commit *c, struct tree *t)
|
||||
{
|
||||
c->maybe_tree = t;
|
||||
@ -3680,6 +3697,13 @@ static void merge_ort_nonrecursive_internal(struct merge_options *opt,
|
||||
{
|
||||
struct object_id working_tree_oid;
|
||||
|
||||
if (opt->subtree_shift) {
|
||||
side2 = shift_tree_object(opt->repo, side1, side2,
|
||||
opt->subtree_shift);
|
||||
merge_base = shift_tree_object(opt->repo, side1, merge_base,
|
||||
opt->subtree_shift);
|
||||
}
|
||||
|
||||
trace2_region_enter("merge", "collect_merge_info", opt->repo);
|
||||
if (collect_merge_info(opt, merge_base, side1, side2) != 0) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user