From: Leif Middelschulte <leif.middelschu...@gmail.com>

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.middelschu...@gmail.com>
Signed-off-by: Stefan Beller <sbel...@google.com>
Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 merge-recursive.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

>> * sb/submodule-merge-in-merge-recursive (2018-05-16) 3 commits
>>  - merge-recursive: give notice when submodule commit gets fast-forwarded
>>  - merge-recursive: i18n submodule merge output and respect verbosity
>>  - submodule.c: move submodule merging to merge-recursive.c
>>
>>  By code restructuring of submodule merge in merge-recursive,
>>  informational messages from the codepath are now given using the
>>  same mechanism as other output, and honor the merge.verbosity
>>  configuration.  The code also learned to give a few new messages
>>  when a submodule three-way merge resolves cleanly when one side
>>  records a descendant of the commit chosen by the other side.
>>
>>  Will merge to 'next'.
>
>Merging would be ok, but I would rather not.
>A resend will be only for cosmetic effect, as I messed up the last commit
>
>So, please hold in pu.

This is the resend, with an interdiff as follows.

Junio wrote in 
http://public-inbox.org/git/xmqqk1s474vx....@gitster-ct.c.googlers.com:

> Perhaps Leif can elaborate why this change is a good idea in the
> first place?

which is also outstanding.

Leif can you pick this patch and resend it with a proper commit message?


    # diff --git c/merge-recursive.c w/merge-recursive.c
    # index 29a430c418a..a9aecccb8c3 100644
    # --- c/merge-recursive.c
    # +++ w/merge-recursive.c
    # @@ -1094,7 +1094,7 @@ static int merge_submodule(struct merge_options *o,
    #   if (in_merge_bases(commit_a, commit_b)) {
    #           oidcpy(result, b);
    #           if (show(o, 3)) {
    # -                 output(o, 1, _("Fast-forwarding submodule %s to the 
following commit:"), path);
    # +                 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));
    # @@ -1106,7 +1106,7 @@ static int merge_submodule(struct merge_options *o,
    #   if (in_merge_bases(commit_b, commit_a)) {
    #           oidcpy(result, a);
    #           if (show(o, 3)) {
    # -                 output(o, 1, _("Fast-forwarding submodule %s to the 
following commit:"), path);
    # +                 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));


diff --git a/merge-recursive.c b/merge-recursive.c
index 0571919ee0a..a9aecccb8c3 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -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;
        }
 
-- 
2.17.0.582.gccdcbd54c44.dirty

Reply via email to