Re: [PATCH v3 3/3] merge: pass aggressive when rename detection is turned off
- From
Elijah Newren <newren@gmail.com>
- Date
- Apr 26, 2018, 23:00 UTC
- Message-ID
- <CABPp-BHg++tvbd+Y8xCCNmi+fAv_4azXCkCWDucFLDj1sXeWAw@mail.gmail.com>
- In-Reply-To
- <20180426205202.23056-4-benpeart@microsoft.com>
On Thu, Apr 26, 2018 at 1:52 PM, Ben Peart <Ben.Peart@microsoft.com> wrote:
Show 41 quoted lines
> Set aggressive flag in git_merge_trees() when rename detection is turned off.
> This allows read_tree() to auto resolve more cases that would have otherwise
> been handled by the rename detection.
>
> Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
> merge-recursive.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/merge-recursive.c b/merge-recursive.c
> index 2637d34d87..6cc4404144 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -276,6 +276,7 @@ static void init_tree_desc_from_tree(struct tree_desc *desc, struct tree *tree)
> }
>
> static int git_merge_trees(int index_only,
> + int aggressive,
> struct tree *common,
> struct tree *head,
> struct tree *merge)
> @@ -294,6 +295,7 @@ static int git_merge_trees(int index_only,
> opts.fn = threeway_merge;
> opts.src_index = &the_index;
> opts.dst_index = &the_index;
> + opts.aggressive = aggressive;
> setup_unpack_trees_porcelain(&opts, "merge");
>
> init_tree_desc_from_tree(t+0, common);
> @@ -1993,7 +1995,7 @@ int merge_trees(struct merge_options *o,
> return 1;
> }
>
> - code = git_merge_trees(o->call_depth, common, head, merge);
> + code = git_merge_trees(o->call_depth, !merge_detect_rename(o), common, head, merge);
>
> if (code != 0) {
> if (show(o, 4) || o->call_depth)
> --
> 2.17.0.windows.1Patch looks fine but as a heads up -- since merge_options is a parameter in git_merge_trees after the en/rename-directory-detection-reboot lands, we'll be able to switch this patch to set opts.aggressive directly instead of needing to pass it in as a parameter.