contrib/subtree: Add split tests
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> Signed-off-by: Jeff King <peff@peff.net>
This commit is contained in:
		 Techlive Zheng
					Techlive Zheng
				
			
				
					committed by
					
						 Jeff King
						Jeff King
					
				
			
			
				
	
			
			
			 Jeff King
						Jeff King
					
				
			
						parent
						
							4f96fcc9a2
						
					
				
				
					commit
					4fe2e33cc9
				
			| @ -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' ' | 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)"'' && | 	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" && | 	check_equal ''"$(last_commit_message)"'' "Split & rejoin" && | ||||||
| 	undo | 	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_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)"'' && | 	spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' && | ||||||
| 	undo && | 	undo && | ||||||
| 	git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --rejoin && | 	git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --rejoin && | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user