Skip to content

Commit

Permalink
contrib/subtree: Add merge tests
Browse files Browse the repository at this point in the history
Add some tests for various merge operations.  Test combinations of merge
with --message, --prefix and --squash.

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>
  • Loading branch information
Techlive Zheng authored and Jeff King committed Nov 13, 2015
1 parent c992499 commit 4f96fcc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contrib/subtree/t/t7900-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,22 @@ test_expect_success 'check if --message for merge works with squash too' '

test_expect_success 'merge new subproj history into subdir' '
git subtree merge --prefix="sub dir" FETCH_HEAD &&
git branch pre-split &&
check_equal ''"$(last_commit_message)"'' "Merge commit '"'"'"$(git rev-parse sub2)"'"'"' into mainline" &&
undo
'

test_expect_success 'merge new subproj history into subdir/ with --prefix and --message' '
git subtree merge --prefix="sub dir" --message="Merged changes from subproject" FETCH_HEAD &&
check_equal "$(last_commit_message)" "Merged changes from subproject" &&
undo
'

test_expect_success 'merge new subproj history into subdir/ with --squash and --prefix and --message' '
git subtree merge --prefix="sub dir" --message="Merged changes from subproject using squash" --squash FETCH_HEAD &&
check_equal "$(last_commit_message)" "Merged changes from subproject using squash" &&
undo
'

test_expect_success 'split requires option --prefix' '
echo "You must provide the --prefix option." > expected &&
test_must_fail git subtree split > actual 2>&1 &&
Expand Down

0 comments on commit 4f96fcc

Please sign in to comment.