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

[PATCH 5/7] contrib/subtree: Add split tests

From
David Greene <greened@obbligato.org>
Date
Nov 6, 2015, 03:35 UTC
Message-ID
<1446780903-22156-6-git-send-email-greened@obbligato.org>
In-Reply-To
<1446780903-22156-1-git-send-email-greened@obbligato.org>
From: Techlive Zheng <techlivezheng@gmail.com>

Add tests to check various options to split. Check combinations of --prefix, --message, --annotate, --branch and --rejoin.

Signed-off-by: Techlive Zheng <techlivezheng@gmail.com>
Signed-off-by: David A. Greene <greened@obbligato.org>
---
 contrib/subtree/t/t7900-subtree.sh | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 7d59a1a..6250194 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -250,7 +250,6 @@ test_expect_success 'split requires path given by option --prefix must exist' '
 
 test_expect_success 'check if --message works for split+rejoin' '
 	spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
-	git branch spl1 "$spl1" &&
 	check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
 	undo
 '
@@ -282,7 +281,21 @@ test_expect_success 'check split with --branch for an incompatible branch' '
 	test_must_fail git subtree split --prefix "sub dir" --onto FETCH_HEAD --branch subdir
 '
 
-test_expect_success 'check split+rejoin' '
+test_expect_success 'split sub dir/ with --rejoin' '
+	spl1=$(git subtree split --prefix="sub dir" --annotate="*") &&
+	git branch spl1 "$spl1" &&
+	git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
+	check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$spl1'\''" &&
+	undo
+'
+
+test_expect_success 'split sub dir/ with --rejoin and --message' '
+	git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
+	check_equal "$(last_commit_message)" "Split & rejoin" &&
+	undo
+'
+
+test_expect_success 'check split+rejoin+onto' '
 	spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
 	undo &&
 	git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --rejoin &&
-- 
2.6.1
Previous: David GreeneNext: David Greene
Message 7 of 9 in “(unknown)”
  1. David GreeneNov 6, 2015
  2. 1/7 contrib/subtree: Clean and refactor test codeDavid Greene, Nov 6, 2015
  3. David A. GreeneNov 11, 2015
  4. 2/7 contrib/subtree: Add test for missing subtreeDavid Greene, Nov 6, 2015
  5. 3/7 contrib/subtree: Add tests for subtree addDavid Greene, Nov 6, 2015
  6. 4/7 contrib/subtree: Add merge testsDavid Greene, Nov 6, 2015
  7. 5/7 contrib/subtree: Add split testsDavid Greene, Nov 6, 2015
  8. 6/7 contrib/subtree: Make each test self-containedDavid Greene, Nov 6, 2015
  9. 7/7 contrib/subtree: Handle '--prefix' argument with a slash appendedDavid Greene, Nov 6, 2015

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.