Skip to content

Commit 4fe2e33

Browse files
weynhamzpeff
authored andcommitted
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 <[email protected]> Signed-off-by: David A. Greene <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 4f96fcc commit 4fe2e33

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

contrib/subtree/t/t7900-subtree.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ test_expect_success 'split requires path given by option --prefix must exist' '
250250

251251
test_expect_success 'check if --message works for split+rejoin' '
252252
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
253-
git branch spl1 "$spl1" &&
254253
check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
255254
undo
256255
'
@@ -282,7 +281,21 @@ test_expect_success 'check split with --branch for an incompatible branch' '
282281
test_must_fail git subtree split --prefix "sub dir" --onto FETCH_HEAD --branch subdir
283282
'
284283

285-
test_expect_success 'check split+rejoin' '
284+
test_expect_success 'split sub dir/ with --rejoin' '
285+
spl1=$(git subtree split --prefix="sub dir" --annotate="*") &&
286+
git branch spl1 "$spl1" &&
287+
git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
288+
check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$spl1'\''" &&
289+
undo
290+
'
291+
292+
test_expect_success 'split sub dir/ with --rejoin and --message' '
293+
git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
294+
check_equal "$(last_commit_message)" "Split & rejoin" &&
295+
undo
296+
'
297+
298+
test_expect_success 'check split+rejoin+onto' '
286299
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
287300
undo &&
288301
git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --rejoin &&

0 commit comments

Comments
 (0)