Thread (8 messages) flat view 8 messages, 1 author, 2016-06-15
DORMANTno replies

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

From: David Greene <hidden>
Date: 2016-06-15 23:07:11
Subsystem: the rest · Maintainer: Linus Torvalds

From: Techlive Zheng <redacted>

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

Signed-off-by: Techlive Zheng <redacted>
Signed-off-by: David A. Greene <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help