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

git rebase + fuzz = possible bad merge

From
BHBenny Halevy <bhalevy@panasas.com>
Date
Mar 23, 2009, 10:41 UTC
Message-ID
<49C7675E.9000309@panasas.com>

I'm hitting bad merges with (non interactive) git rebase when a hunk is merged pre-maturely into an inexact match when there's fuzz.

The following shell script reproduce this with git version 1.6.2.1:

#!/bin/sh

rm -rf test_file .git git init

cat >test_file <<EOF
struct one {
	line 1;
	line 2;
	line 3;
	line 4;
	line 5;
	line 6;
	line 7;
};
struct two {
	line 1;
	line 2;
	line 3;
	line 4;
	line 5;
	line 6;
	line 7;
};
EOF

git add test_file git commit -m test_file

git am <<EOF
From: Benny Halevy <bhalevy@panasas.com>
Subject: change struct two
diff --git a/test_file b/test_file
--- a/test_file
+++ b/test_file
@@ -12,7 +12,7 @@ struct two {
 	line 1;
 	line 2;
 	line 3;
-	line 4;
+	LINE 4;
 	line 5;
 	line 6;
 	line 7;
EOF

git checkout -b test_branch HEAD^
{ for i in {1..10}; do echo fuzz $i; done; echo; cat test_file; } > fuzz_file
mv fuzz_file test_file

git commit -a -m fuzz

git rebase --onto test_branch master^ master

if [ $(awk '/LINE/ {print NR}' test_file) != 26 ]; then
	echo 1>&2 $0: test failed
	exit 1
else
	echo 1>&2 $0: test succeeded
fi
Next: Thomas Rast
Message 1 of 4 in “git rebase + fuzz = possible bad merge”
  1. Benny HalevyMar 23, 2009
  2. Thomas RastMar 23, 2009
  3. Benny HalevyMar 23, 2009
  4. Benny HalevyMar 23, 2009

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.