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

[PATCH] New test to check the real "subtree" case

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Feb 28, 2008, 01:51 UTC
Message-ID
<20080228015122.GB31441@genesis.frugalware.org>
In-Reply-To
<7vprun32m2.fsf@gitster.siamese.dyndns.org>

t6029 already checks if subtree available and works like recursive, but this new one actually tests the extra functionality the subtree merge strategy provides.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Sat, Feb 23, 2008 at 11:16:21AM -0800, Junio C Hamano <gitster@pobox.com> wrote:
> A new test t6029 currently only tests the strategy is available,
> but it should be enhanced to check the real "subtree" case.
i think something like this should do it.
 t/t3035-merge-subtree.sh |   54 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100755 t/t3035-merge-subtree.sh
diff --git a/t/t3035-merge-subtree.sh b/t/t3035-merge-subtree.sh
new file mode 100755
index 0000000..e400dce
--- /dev/null
+++ b/t/t3035-merge-subtree.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+test_description='merge-subtree backend test'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	mkdir git-gui &&
+	cd git-gui &&
+	git init &&
+	echo git-gui > git-gui.sh &&
+	o1=$(git hash-object git-gui.sh) &&
+	git add git-gui.sh &&
+	git commit -m "initial git-gui" &&
+	cd .. &&
+	mkdir git &&
+	cd git &&
+	git init &&
+	echo git >git.c &&
+	o2=$(git hash-object git.c) &&
+	git add git.c &&
+	git commit -m "initial git"
+'
+
+test_expect_success 'initial merge' '
+	git remote add -f gui ../git-gui &&
+	git merge -s ours --no-commit gui/master &&
+	git read-tree --prefix=git-gui/ -u gui/master &&
+	git commit -m "Merge git-gui as our subdirectory" &&
+	git ls-files -s >actual &&
+	(
+		echo "100644 $o1 0	git-gui/git-gui.sh"
+		echo "100644 $o2 0	git.c"
+	) >expected &&
+	git diff -u expected actual
+'
+
+test_expect_success 'merge update' '
+	cd ../git-gui &&
+	echo git-gui2 > git-gui.sh &&
+	o3=$(git hash-object git-gui.sh) &&
+	git add git-gui.sh &&
+	git commit -m "update git-gui" &&
+	cd ../git &&
+	git pull -s subtree gui master &&
+	git ls-files -s >actual &&
+	(
+		echo "100644 $o3 0	git-gui/git-gui.sh"
+		echo "100644 $o2 0	git.c"
+	) >expected &&
+	git diff -u expected actual
+'
+
+test_done
-- 
1.5.4.3
Previous: Daniel BarkalowNext: Johannes Schindelin
Message 3 of 6 in “Add merge-subtree back”
  1. Add merge-subtree backJunio C Hamano, Feb 23, 2008
  2. Daniel BarkalowFeb 24, 2008
  3. New test to check the real "subtree" caseMiklos Vajna, Feb 28, 2008
  4. Johannes SchindelinFeb 28, 2008
  5. Improve t6029 to check the real "subtree" caseMiklos Vajna, Feb 28, 2008
  6. Johannes SchindelinFeb 28, 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.