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 68d03e4a6e44 ("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>

Leif Middelschulte committed May 17, 2018 at 11:40 UTC 76f421259718f5f504558e97dfb99e16c9ceb7c6
1 file changed +16
merge-recursive.c
+16
@@ -1093,10 +1093,26 @@ static int merge_submodule(struct merge_options *o,
1093 /* Case #1: a is contained in b or vice versa */
1094 if (in_merge_bases(commit_a, commit_b)) {
1095 oidcpy(result, b);
1096 + if (show(o, 3)) {
1097 + output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
1098 + output_commit_title(o, commit_b);
1099 + } else if (show(o, 2))
1100 + output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(b));
1101 + else
1102 + ; /* no output */
1103 +
1104 return 1;
1105 }
1106 if (in_merge_bases(commit_b, commit_a)) {
1107 oidcpy(result, a);
1108 + if (show(o, 3)) {
1109 + output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
1110 + output_commit_title(o, commit_a);
1111 + } else if (show(o, 2))
1112 + output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(a));
1113 + else
1114 + ; /* no output */
1115 +
1116 return 1;
1117 }
1118