git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Leif Middelschulte <leif.middelschulte@gmail.com>
Cc: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
	sandals@crustytoothpaste.ath.cx
Subject: Re: [PATCH 1/1] Warn about fast-forwarding of submodules during merge
Date: Thu, 10 May 2018 11:49:37 -0700
Message-ID: <CAGZ79ka3kVHSZ9oG=NOvr0=KCHODngxJQLbKApDsFY=xNPhU=A@mail.gmail.com> (raw)
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!

> 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

  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 18:26 [PATCH 0/1] warn about auto fast-forwarded submodules during merges Leif Middelschulte
2018-05-10 18:26 ` [PATCH 1/1] Warn about fast-forwarding of submodules during merge Leif Middelschulte
2018-05-10 18:49   ` Stefan Beller [this message]
2018-05-10 20:30     ` Leif Middelschulte
2018-05-10 21:19       ` [PATCH 0/2] Submodule merging: i18n, verbosity Stefan Beller
2018-05-10 21:19         ` [PATCH 1/2] submodule.c: move submodule merging to merge-recursive.c Stefan Beller
2018-05-10 21:19         ` [PATCH 2/2] merge-recursive: i18n submodule merge output and respect verbosity Stefan Beller
2018-05-15  1:25           ` Elijah Newren
2018-05-11  0:04         ` [PATCH 0/2] Submodule merging: i18n, verbosity Elijah Newren
2018-05-11  1:00           ` Stefan Beller
2018-05-14 20:57             ` [PATCH 0/1] rebased: inform about auto submodule ff during merge Leif Middelschulte
2018-05-14 20:57               ` [PATCH 1/1] Inform about fast-forwarding of submodules " Leif Middelschulte
2018-05-15  0:41                 ` Stefan Beller
2018-05-15  1:17                 ` Elijah Newren
2018-05-15  7:34                   ` Junio C Hamano

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79ka3kVHSZ9oG=NOvr0=KCHODngxJQLbKApDsFY=xNPhU=A@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=leif.middelschulte@gmail.com \
    --cc=sandals@crustytoothpaste.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox