merge-recursive: give notice when submodule commit gets fast-forwarded

Inform the user about an automatically fast-forwarded submodule. The
silent merge behavior was introduced by commit 68d03e4a6e ("Implement
automatic fast-forward merge for submodules", 2010-07-07)).

Signed-off-by: Leif Middelschulte <Leif.Middelschulte@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Leif Middelschulte 2018-05-17 11:40:08 -07:00 committed by Junio C Hamano
parent 325f3a8e07
commit 76f4212597

View File

@ -1093,10 +1093,26 @@ static int merge_submodule(struct merge_options *o,
/* Case #1: a is contained in b or vice versa */
if (in_merge_bases(commit_a, commit_b)) {
oidcpy(result, b);
if (show(o, 3)) {
output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
output_commit_title(o, commit_b);
} else if (show(o, 2))
output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(b));
else
; /* no output */
return 1;
}
if (in_merge_bases(commit_b, commit_a)) {
oidcpy(result, a);
if (show(o, 3)) {
output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
output_commit_title(o, commit_a);
} else if (show(o, 2))
output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(a));
else
; /* no output */
return 1;
}