[PATCH 3/7] contrib/subtree: Add tests for subtree add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Techlive Zheng <techlivezheng@xxxxxxxxx>

Add some tests to check various options to subtree add.  These test
various combinations of --message, --prefix and --squash.

Signed-off-by: Techlive Zheng <techlivezheng@xxxxxxxxx>
Signed-off-by: David A. Greene <greened@xxxxxxxxxxxxx>
---
 contrib/subtree/t/t7900-subtree.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 4471786..1fa5991 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -127,12 +127,24 @@ test_expect_success 'no merge from non-existent subtree' '
 	test_must_fail git subtree merge --prefix="sub dir" FETCH_HEAD
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
+	git subtree add --prefix="sub dir" sub1 &&
+	check_equal "$(last_commit_message)" "Add '\''sub dir/'\'' from commit '\''$(git rev-parse sub1)'\''" &&
+	undo
+'
+
 test_expect_success 'check if --message works for add' '
 	git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
 	check_equal ''"$(last_commit_message)"'' "Added subproject" &&
 	undo
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --message' '
+	git subtree add --prefix="sub dir" --message="Added subproject" sub1 &&
+	check_equal "$(last_commit_message)" "Added subproject" &&
+	undo
+'
+
 test_expect_success 'check if --message works as -m and --prefix as -P' '
 	git subtree add -P "sub dir" -m "Added subproject using git subtree" sub1 &&
 	check_equal ''"$(last_commit_message)"'' "Added subproject using git subtree" &&
@@ -145,6 +157,13 @@ test_expect_success 'check if --message works with squash too' '
 	undo
 '
 
+test_expect_success 'add subproj as subtree into sub dir/ with --squash and --prefix and --message' '
+	git subtree add --prefix="sub dir" --message="Added subproject with squash" --squash sub1 &&
+	check_equal "$(last_commit_message)" "Added subproject with squash" &&
+	undo
+'
+
+# Maybe delete
 test_expect_success 'add subproj to mainline' '
 	git subtree add --prefix="sub dir"/ FETCH_HEAD &&
 	check_equal ''"$(last_commit_message)"'' "Add '"'sub dir/'"' from commit '"'"'''"$(git rev-parse sub1)"'''"'"'"
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]