Re: [PATCH 3/3] Inform about fast-forwarding of submodules during merge
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 16, 2018, 01:36 UTC
- Message-ID
- <xmqqo9hg7554.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180515200030.88731-6-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> From: Leif Middelschulte <Leif.Middelschulte@gmail.com> >
Subject: merge-recursive: give notice when submodule commit gets fast-forwarded
perhaps?
Show 11 quoted lines
> /* 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, 1, _("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 */
> +merge.verbosity:: Controls the amount of output shown by the recursive merge strategy. Level 0 outputs nothing except a final error message if conflicts were detected. Level 1 outputs only conflicts, 2 outputs conflicts and file changes. Level 5 and above outputs debugging information. The default is level 2. Can be overridden by the `GIT_MERGE_VERBOSITY` environment variable.
So, by default, we report the fact that we update submodule to a particular commit, which is quite similar to how we report auto merged paths using the content level 3-way merge; when you squint your eyes, the "fast-forward" of submodules look somewhat like a content-level 3-way merge anyway ;-)
And at level 3, which currently is used to report a non-event that does not change the result of the merge from what was naturally expected, we give a bit more detail by citing the commit the submodule gets fast-forwarded to [*1*].
Sort of makes sense.
[Footnote]
*1* I wonder if that is really necessary, though---we do not give "here is a diff" or "this is the new contents" after a path gets merged for normal files. And if it is needed perhaps because submodules are so special, I wonder if we also need to give the commit the submodule gets fast-forwarded from, i.e. the original one, the same way.