diff options
Diffstat (limited to 't/t5533-push-cas.sh')
-rwxr-xr-x | t/t5533-push-cas.sh | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh index c402d8d3d7..a2c9e7439f 100755 --- a/t/t5533-push-cas.sh +++ b/t/t5533-push-cas.sh @@ -25,7 +25,8 @@ test_expect_success 'push to update (protected)' ' ( cd dst && test_commit D && - test_must_fail git push --force-with-lease=master:master origin master + test_must_fail git push --force-with-lease=master:master origin master 2>err && + grep "stale info" err ) && git ls-remote . refs/heads/master >expect && git ls-remote src refs/heads/master >actual && @@ -37,7 +38,8 @@ test_expect_success 'push to update (protected, forced)' ' ( cd dst && test_commit D && - git push --force --force-with-lease=master:master origin master + git push --force --force-with-lease=master:master origin master 2>err && + grep "forced update" err ) && git ls-remote dst refs/heads/master >expect && git ls-remote src refs/heads/master >actual && @@ -101,7 +103,8 @@ test_expect_success 'push to update (allowed, tracking)' ' ( cd dst && test_commit D && - git push --force-with-lease=master origin master + git push --force-with-lease=master origin master 2>err && + ! grep "forced update" err ) && git ls-remote dst refs/heads/master >expect && git ls-remote src refs/heads/master >actual && @@ -114,7 +117,8 @@ test_expect_success 'push to update (allowed even though no-ff)' ' cd dst && git reset --hard HEAD^ && test_commit D && - git push --force-with-lease=master origin master + git push --force-with-lease=master origin master 2>err && + grep "forced update" err ) && git ls-remote dst refs/heads/master >expect && git ls-remote src refs/heads/master >actual && @@ -147,7 +151,8 @@ test_expect_success 'push to delete (allowed)' ' setup_srcdst_basic && ( cd dst && - git push --force-with-lease=master origin :master + git push --force-with-lease=master origin :master 2>err && + grep deleted err ) && >expect && git ls-remote src refs/heads/master >actual && @@ -186,4 +191,42 @@ test_expect_success 'cover everything with default force-with-lease (allowed)' ' test_cmp expect actual ' +test_expect_success 'new branch covered by force-with-lease' ' + setup_srcdst_basic && + ( + cd dst && + git branch branch master && + git push --force-with-lease=branch origin branch + ) && + git ls-remote dst refs/heads/branch >expect && + git ls-remote src refs/heads/branch >actual && + test_cmp expect actual +' + +test_expect_success 'new branch covered by force-with-lease (explicit)' ' + setup_srcdst_basic && + ( + cd dst && + git branch branch master && + git push --force-with-lease=branch: origin branch + ) && + git ls-remote dst refs/heads/branch >expect && + git ls-remote src refs/heads/branch >actual && + test_cmp expect actual +' + +test_expect_success 'new branch already exists' ' + setup_srcdst_basic && + ( + cd src && + git checkout -b branch master && + test_commit F + ) && + ( + cd dst && + git branch branch master && + test_must_fail git push --force-with-lease=branch: origin branch + ) +' + test_done |