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>
Techlive Zheng committed
Nov 12, 2015 at 20:32 UTC
4fe2e33cc961328ea24e821692abc305d28e8ddb
1 file changed
+15
-2
contrib/subtree/t/t7900-subtree.sh
+15
-2
@@ -250,7 +250,6 @@ test_expect_success 'split requires path given by option --prefix must exist' '
250
251
test_expect_success 'check if --message works for split+rejoin' '
252
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
253
- git branch spl1 "$spl1" &&
253
check_equal ''"$(last_commit_message)"'' "Split & rejoin" &&
254
undo
255
'
@@ -282,7 +281,21 @@ test_expect_success 'check split with --branch for an incompatible branch' '
281
test_must_fail git subtree split --prefix "sub dir" --onto FETCH_HEAD --branch subdir
282
'
283
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' '
299
spl1=''"$(git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --message "Split & rejoin" --rejoin)"'' &&
300
undo &&
301
git subtree split --annotate='"'*'"' --prefix "sub dir" --onto FETCH_HEAD --rejoin &&