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

[PATCH] Documentation/git-bisect.txt: add --no-ff to merge command

From
MAMihail Atanassov <m.atanassov92@gmail.com>
Date
Oct 25, 2019, 22:20 UTC
Message-ID
<20191025222032.3399-1-m.atanassov92@gmail.com>

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(-)
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
-if	git merge --no-commit hot-fix &&
+# 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.
+if	git merge --no-commit --no-ff hot-fix &&
 	make
 then
 	# run project specific test and report its status
-- 
2.16.4
Next: Jonathan Nieder
Message 1 of 6 in “Documentation/git-bisect.txt: add --no-ff to merge command”
  1. Documentation/git-bisect.txt: add --no-ff to merge commandMihail Atanassov, Oct 25, 2019
  2. Jonathan NiederOct 26, 2019
  3. Mihail AtanassovOct 28, 2019
  4. Jonathan NiederOct 28, 2019
  5. Junio C HamanoOct 29, 2019
  6. Junio C HamanoOct 29, 2019

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.