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

[PATCH 3/3] t7603: add new testcases to ensure builtin-commit uses reduce_heads()

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Sep 10, 2008, 20:10 UTC
Message-ID
<e2b601d3a89785ec9da5de061adc37693a3bd323.1221077214.git.vmiklos@frugalware.org>
In-Reply-To
<2984711bae2f0777b210ed04210693ac02164519.1221077214.git.vmiklos@frugalware.org>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 t/t7603-merge-reduce-heads.sh |   53 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh
index b47b7b9..7e17eb4 100755
--- a/t/t7603-merge-reduce-heads.sh
+++ b/t/t7603-merge-reduce-heads.sh
@@ -60,4 +60,57 @@ test_expect_success 'merge c1 with c2, c3, c4, c5' '
 	test -f c5.c
 '
 
+test_expect_success 'setup' '
+	for i in A B C D E
+	do
+		echo $i > $i.c &&
+		git add $i.c &&
+		git commit -m $i &&
+		git tag $i
+	done &&
+	git reset --hard A &&
+	for i in F G H I
+	do
+		echo $i > $i.c &&
+		git add $i.c &&
+		git commit -m $i &&
+		git tag $i
+	done
+'
+
+test_expect_success 'merge E and I' '
+	git reset --hard A &&
+	git merge E I
+'
+
+test_expect_success 'verify merge result' '
+	test $(git rev-parse HEAD^1) = $(git rev-parse E) &&
+	test $(git rev-parse HEAD^2) = $(git rev-parse I)
+'
+
+test_expect_success 'add conflicts' '
+	git reset --hard E &&
+	echo foo > file.c &&
+	git add file.c &&
+	git commit -m E2 &&
+	git tag E2 &&
+	git reset --hard I &&
+	echo bar >file.c &&
+	git add file.c &&
+	git commit -m I2 &&
+	git tag I2
+'
+
+test_expect_success 'merge E2 and I2, causing a conflict and resolve it' '
+	git reset --hard A &&
+	test_must_fail git merge E2 I2 &&
+	echo baz > file.c &&
+	git add file.c &&
+	git commit -m "resolve conflict"
+'
+
+test_expect_success 'verify merge result' '
+	test $(git rev-parse HEAD^1) = $(git rev-parse E2) &&
+	test $(git rev-parse HEAD^2) = $(git rev-parse I2)
+'
 test_done
-- 
1.6.0.1
Previous: Miklos Vajna
Message 4 of 4 in “make builtin-commit use commit_tree() and reduce_heads()”
  1. 0/3 make builtin-commit use commit_tree() and reduce_heads()Miklos Vajna, Sep 10, 2008
  2. 1/3 commit_tree(): add a new author parameterMiklos Vajna, Sep 10, 2008
  3. 2/3 builtin-commit: use commit_tree()Miklos Vajna, Sep 10, 2008
  4. 3/3 t7603: add new testcases to ensure builtin-commit uses reduce_heads()Miklos Vajna, Sep 10, 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.