Skip to content

Commit 345480d

Browse files
newrengitster
authored andcommitted
merge-recursive: don't force external callers to do our logging
Alternatively, you can view this as "make the merge functions behave more similarly." merge-recursive has three different entry points: merge_trees(), merge_recursive(), and merge_recursive_generic(). Two of these would call diff_warn_rename_limit(), but merge_trees() didn't. This lead to callers of merge_trees() needing to manually call diff_warn_rename_limit() themselves. Move this to the new merge_finalize() function to make sure that all three entry points run this function. Note that there are two external callers of merge_trees(), one in sequencer.c and one in builtin/checkout.c. The one in sequencer.c is cleaned up by this patch and just transfers where the call to diff_warn_rename_limit() is made; the one in builtin/checkout.c is for switching to a different commit and in the very rare case where the warning might be triggered, it would probably be helpful to include (e.g. if someone is modifying a file that has been renamed in moving to the other commit, but there are so many renames between the commits that the limit kicks in and none are detected, it may help to have an explanation about why they got a delete/modify conflict instead of a proper content merge in a renamed file). Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b4db8a2 commit 345480d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

merge-recursive.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3595,9 +3595,6 @@ static int merge_recursive_internal(struct merge_options *opt,
35953595
flush_output(opt);
35963596
if (!opt->call_depth && opt->buffer_output < 2)
35973597
strbuf_release(&opt->obuf);
3598-
if (show(opt, 2))
3599-
diff_warn_rename_limit("merge.renamelimit",
3600-
opt->needed_rename_limit, 0);
36013598
return clean;
36023599
}
36033600

@@ -3617,7 +3614,9 @@ static int merge_start(struct merge_options *opt, struct tree *head)
36173614

36183615
static void merge_finalize(struct merge_options *opt)
36193616
{
3620-
/* Common code for wrapping up merges will be added here later */
3617+
if (show(opt, 2))
3618+
diff_warn_rename_limit("merge.renamelimit",
3619+
opt->needed_rename_limit, 0);
36213620
}
36223621

36233622
int merge_trees(struct merge_options *opt,

sequencer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ static int do_recursive_merge(struct repository *r,
617617
if (is_rebase_i(opts) && clean <= 0)
618618
fputs(o.obuf.buf, stdout);
619619
strbuf_release(&o.obuf);
620-
diff_warn_rename_limit("merge.renamelimit", o.needed_rename_limit, 0);
621620
if (clean < 0) {
622621
rollback_lock_file(&index_lock);
623622
return clean;

0 commit comments

Comments
 (0)