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

[PATCH] Add a new test for git-merge-resolve

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Jul 12, 2008, 22:33 UTC
Message-ID
<1215902015-5102-1-git-send-email-vmiklos@frugalware.org>
In-Reply-To
<1215888130-3260-1-git-send-email-vmiklos@frugalware.org>

Actually this is a simple test, just to ensure merge-resolve properly calls read-tree. read-tree itself already has more complex tests.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

This one adds tests in a new file; it tests merge-resolve as well, just as my previous patch, but I though it's better if I just add the multiple-base merge one to the end of the existing criss-cross tests.

So this is not a replacement, both are sent for inclusion.
 t/t7605-merge-resolve.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
 create mode 100755 t/t7605-merge-resolve.sh
diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh
new file mode 100755
index 0000000..ee21a10
--- /dev/null
+++ b/t/t7605-merge-resolve.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+test_description='git-merge
+
+Testing the resolve strategy.'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	echo c0 > c0.c &&
+	git add c0.c &&
+	git commit -m c0 &&
+	git tag c0 &&
+	echo c1 > c1.c &&
+	git add c1.c &&
+	git commit -m c1 &&
+	git tag c1 &&
+	git reset --hard c0 &&
+	echo c2 > c2.c &&
+	git add c2.c &&
+	git commit -m c2 &&
+	git tag c2 &&
+	git reset --hard c0 &&
+	echo c3 > c2.c &&
+	git add c2.c &&
+	git commit -m c3 &&
+	git tag c3
+'
+
+test_expect_success 'merge c1 to c2' '
+	git reset --hard c1 &&
+	git merge -s resolve c2 &&
+	test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
+	test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
+	test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
+	git diff --exit-code &&
+	test -f c0.c &&
+	test -f c1.c &&
+	test -f c2.c
+'
+
+test_expect_success 'merge c2 to c3 (fails)' '
+	git reset --hard c2 &&
+	test_must_fail git merge -s resolve c3
+'
+test_done
-- 
1.5.6.2.450.g8d367.dirty
Previous: Miklos Vajna
Message 2 of 2 in “t6021: add a new test for git-merge-resolve”
  1. t6021: add a new test for git-merge-resolveMiklos Vajna, Jul 12, 2008
  2. Add a new test for git-merge-resolveMiklos Vajna, Jul 12, 2008

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.