Skip to content

Commit 526705f

Browse files
jerry-skydiogitster
authored andcommitted
apply: adjust messages to account for --3way changes
"git apply" specifically calls out when it is falling back to 3way merge application. Since the order changed to preferring 3way and falling back to direct application, continue that behavior by printing whenever 3way fails and git has to fall back. Signed-off-by: Jerry Zhang <jerry@skydio.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 923cd87 commit 526705f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apply.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3572,7 +3572,7 @@ static int try_threeway(struct apply_state *state,
35723572
read_blob_object(&buf, &pre_oid, patch->old_mode))
35733573
return error(_("repository lacks the necessary blob to perform 3-way merge."));
35743574

3575-
if (state->apply_verbosity > verbosity_silent)
3575+
if (state->apply_verbosity > verbosity_silent && patch->direct_to_threeway)
35763576
fprintf(stderr, _("Performing three-way merge...\n"));
35773577

35783578
img = strbuf_detach(&buf, &len);
@@ -3639,6 +3639,10 @@ static int apply_data(struct apply_state *state, struct patch *patch,
36393639
return -1;
36403640

36413641
if (!state->threeway || try_threeway(state, &image, patch, st, ce) < 0) {
3642+
if (state->apply_verbosity > verbosity_silent &&
3643+
state->threeway && !patch->direct_to_threeway)
3644+
fprintf(stderr, _("Falling back to direct application...\n"));
3645+
36423646
/* Note: with --reject, apply_fragments() returns 0 */
36433647
if (patch->direct_to_threeway || apply_fragments(state, &image, patch) < 0)
36443648
return -1;

0 commit comments

Comments
 (0)