diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2021-04-27 15:17:47 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-28 16:47:19 +0900 |
commit | 49470cd445166fbe778218c7618ea8ee78ca7d00 (patch) | |
tree | 2fb21e14de3ccca4ad261410f449f5a1e305ad1e /contrib/subtree/t | |
parent | subtree: allow 'split' flags to be passed to 'push' (diff) | |
download | tgif-49470cd445166fbe778218c7618ea8ee78ca7d00.tar.xz |
subtree: push: allow specifying a local rev other than HEAD
'git subtree split' lets you specify a rev other than HEAD. 'git push'
lets you specify a mapping between a local thing and a remot ref. So
smash those together, and have 'git subtree push' let you specify which
local thing to run split on and push the result of that split to the
remote ref.
Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/subtree/t')
-rwxr-xr-x | contrib/subtree/t/t7900-subtree.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh index 5a6541437b..d7ad6ffff0 100755 --- a/contrib/subtree/t/t7900-subtree.sh +++ b/contrib/subtree/t/t7900-subtree.sh @@ -820,6 +820,28 @@ test_expect_success 'push "sub dir"/ with --branch for an incompatible branch' ' ) ' +test_expect_success 'push "sub dir"/ with a local rev' ' + subtree_test_create_repo "$test_count" && + subtree_test_create_repo "$test_count/sub proj" && + test_create_commit "$test_count" main1 && + test_create_commit "$test_count/sub proj" sub1 && + ( + cd "$test_count" && + git fetch ./"sub proj" HEAD && + git subtree add --prefix="sub dir" FETCH_HEAD + ) && + test_create_commit "$test_count" "sub dir"/main-sub1 && + test_create_commit "$test_count" "sub dir"/main-sub2 && + ( + cd "$test_count" && + bad_tree=$(git rev-parse --verify HEAD:"sub dir") && + good_tree=$(git rev-parse --verify HEAD^:"sub dir") && + git subtree push --prefix="sub dir" --annotate="*" ./"sub proj" HEAD^:from-mainline && + split_tree=$(git -C "sub proj" rev-parse --verify refs/heads/from-mainline:) && + test "$split_tree" = "$good_tree" + ) +' + # # Validity checking # |