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

[PATCH 5/6] Add a testcase demonstrating a bug with trivial merges

From
Elijah Newren <newren@gmail.com>
Date
Apr 10, 2016, 06:13 UTC
Message-ID
<1460268820-8308-6-git-send-email-newren@gmail.com>
In-Reply-To
<1460268820-8308-1-git-send-email-newren@gmail.com>

Repeating a trivially merge more than once will leave the index out of sync, despite being clean before the merge and operating on the exact same heads as the first run. The recorded merge has the correct tree and the working tree is brought up to date, it is just the index that is left as it was before the merge. Every attempt to repeat the merge beyond the first will leave the index in the same weird out-of-sync state.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 t/t7605-merge-resolve.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh
index 0cb9d11..2f80037 100755
--- a/t/t7605-merge-resolve.sh
+++ b/t/t7605-merge-resolve.sh
@@ -27,7 +27,7 @@ test_expect_success 'setup' '
 	git tag c3
 '
 
-test_expect_success 'merge c1 to c2' '
+merge_c1_to_c2_cmds='
 	git reset --hard c1 &&
 	git merge -s resolve c2 &&
 	test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
@@ -41,6 +41,10 @@ test_expect_success 'merge c1 to c2' '
 	test 3 = $(git ls-files | wc -l)
 '
 
+test_expect_success 'merge c1 to c2'        "$merge_c1_to_c2_cmds"
+
+test_expect_failure 'merge c1 to c2, again' "$merge_c1_to_c2_cmds"
+
 test_expect_success 'merge c2 to c3 (fails)' '
 	git reset --hard c2 &&
 	test_must_fail git merge -s resolve c3
-- 
2.8.0.21.g229f62a
Previous: Elijah NewrenNext: Elijah Newren
Message 7 of 10 in “Miscellaneous merge fixes”
  1. 0/6 Miscellaneous merge fixesElijah Newren, Apr 10, 2016
  2. 1/6 Remove duplicate codeElijah Newren, Apr 10, 2016
  3. 2/6 Avoid checking working copy when creating a virtual merge baseElijah Newren, Apr 10, 2016
  4. Junio C HamanoApr 13, 2016
  5. 3/6 Add merge testcases for when index doesn't match HEADElijah Newren, Apr 10, 2016
  6. 4/6 merge-octopus: Abort if index does not match HEADElijah Newren, Apr 10, 2016
  7. 5/6 Add a testcase demonstrating a bug with trivial mergesElijah Newren, Apr 10, 2016
  8. 6/6 builtin/merge.c: Fix a bug with trivial mergesElijah Newren, Apr 10, 2016
  9. Junio C HamanoApr 13, 2016
  10. Elijah NewrenApr 15, 2016

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.