git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Mihail Atanassov <m.atanassov92@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Documentation/git-bisect.txt: add --no-ff to merge command
Date: Fri, 25 Oct 2019 19:26:55 -0700	[thread overview]
Message-ID: <20191026022655.GF39574@google.com> (raw)
In-Reply-To: <20191025222032.3399-1-m.atanassov92@gmail.com>

Hi,

Mihail Atanassov wrote:

> The hotfix application example uses `git merge --no-commit` to apply
> temporary changes to the working tree during a bisect operation. In some
> situations this can be a fast-forward and `merge` will apply the hotfix
> branch's commits regardless of `--no-commit` (as documented in the `git
> merge` manual).
>
> In the pathological case this will make a `git bisect
> run` invocation to loop indefinitely between the first bisect step and
> the fast-forwarded post-merge HEAD.
>
> Add `--no-ff` to the merge command to avoid this issue, and make a note
> of it for the reader.
>
> Signed-off-by: Mihail Atanassov <m.atanassov92@gmail.com>
> ---
>  Documentation/git-bisect.txt | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Good catch.  Thanks for fixing it.

> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
> index 4b45d837a7..58b5585874 100644
> --- a/Documentation/git-bisect.txt
> +++ b/Documentation/git-bisect.txt
> @@ -412,8 +412,10 @@ $ cat ~/test.sh
>  #!/bin/sh
>  
>  # tweak the working tree by merging the hot-fix branch
> -# and then attempt a build
> +# and then attempt a build. Note the `--no-ff`: `git merge`
> +# will otherwise still apply commits if the current HEAD can be
> +# fast-forwarded to the hot-fix branch.

Hmm.  I think the comment might put a bit too much emphasis on the
"how" instead of the "why".  Is it necessary to describe why --no-ff
is used at all here?  After all, a reader wondering about it is likely
to check "git help merge", which says

	Fast-forward updates do not create a merge commit and
	therefore there is no way to stop those merges with
	--no-commit.  Thus, if you want to ensure your branch is not
	changed or updated by the merge command, use --no-ff with
	--no-commit.

So I'd be tempted to leave the comment ending with "and then attempt a
build".

Alternatively: the wording says "will still apply commits", but the
reader might not think of a merge as applying patches (that's closer
to what cherry-pick does.  Is there some alternative wording that
would convey the intent more clearly?

> -if	git merge --no-commit hot-fix &&
> +if	git merge --no-commit --no-ff hot-fix &&

Good.

Thanks and hope that helps,
Jonathan

  reply	other threads:[~2019-10-26  2:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 22:20 [PATCH] Documentation/git-bisect.txt: add --no-ff to merge command Mihail Atanassov
2019-10-26  2:26 ` Jonathan Nieder [this message]
     [not found]   ` <CALs020+0E=7wy-N46BRLrBcKmMSTpcMyZ9WybmgTzb60aCo5PQ@mail.gmail.com>
2019-10-28 22:10     ` Mihail Atanassov
2019-10-28 22:24       ` Jonathan Nieder
2019-10-29  2:24         ` Junio C Hamano
2019-10-29  3:25           ` Junio C Hamano

Reply instructions:

You may reply publicly 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

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

  git send-email \
    --in-reply-to=20191026022655.GF39574@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=m.atanassov92@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).