git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Warn about fast-forwarding of submodules during merge

From
Stefan Beller <sbeller@google.com>
Date
May 10, 2018, 18:49 UTC
Message-ID
<CAGZ79ka3kVHSZ9oG=NOvr0=KCHODngxJQLbKApDsFY=xNPhU=A@mail.gmail.com>
In-Reply-To
<20180510182657.65095-2-leif.middelschulte@gmail.com>

On Thu, May 10, 2018 at 11:26 AM, Leif Middelschulte <leif.middelschulte@gmail.com> wrote:

> From: Leif Middelschulte <Leif.Middelschulte@gmail.com>
Hi Leif!
thanks for following up with a patch!
Show 25 quoted lines
> Warn 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>
> ---
>  submodule.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/submodule.c b/submodule.c
> index 74d35b257..0198a72e6 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1817,10 +1817,12 @@ int merge_submodule(struct object_id *result, const char *path,
>         /* Case #1: a is contained in b or vice versa */
>         if (in_merge_bases(commit_a, commit_b)) {
>                 oidcpy(result, b);
> +               warning("Fast-forwarding submodule %s", path);
>                 return 1;
>         }
>         if (in_merge_bases(commit_b, commit_a)) {
>                 oidcpy(result, a);
> +               warning("Fast-forwarding submodule %s", path);
>                 return 1;
>         }

The code looks correct, however I think we can improve it. (Originally I was just wondering if stderr is the right output, which lead me to the thoughts below:)

Looking through the code of merge-recursive.c, all the other merge outputs are done via 'output()' that is able to buffer up the output as well as handles the output for different verbosity settings.

So I would think we should make the output() function available outside of merge-recursive.c. (and rename it to a be more concise and descriptive in the global namespace) and make use of it.

Funnily we already have MERGE_WARNING in submodule.c which outputs information for all the other cases. I would think we ought to convert those to the output(), too.

Thanks, Stefan

Previous: Leif MiddelschulteNext: Leif Middelschulte
Message 3 of 15 in “warn about auto fast-forwarded submodules during merges”
  1. 0/1 warn about auto fast-forwarded submodules during mergesLeif Middelschulte, May 10, 2018
  2. 1/1 Warn about fast-forwarding of submodules during mergeLeif Middelschulte, May 10, 2018
  3. Stefan BellerMay 10, 2018
  4. Leif MiddelschulteMay 10, 2018
  5. 0/2 Submodule merging: i18n, verbosityStefan Beller, May 10, 2018
  6. 1/2 submodule.c: move submodule merging to merge-recursive.cStefan Beller, May 10, 2018
  7. 2/2 merge-recursive: i18n submodule merge output and respect verbosityStefan Beller, May 10, 2018
  8. Elijah NewrenMay 15, 2018
  9. Elijah NewrenMay 11, 2018
  10. Stefan BellerMay 11, 2018
  11. 0/1 rebased: inform about auto submodule ff during mergeLeif Middelschulte, May 14, 2018
  12. 1/1 Inform about fast-forwarding of submodules during mergeLeif Middelschulte, May 14, 2018
  13. Stefan BellerMay 15, 2018
  14. Elijah NewrenMay 15, 2018
  15. Junio C HamanoMay 15, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.