summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-10 19:33:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-10 19:33:18 (GMT)
commite6747627865347a534e7106bb1d14e32867b234d (patch)
treee1d42d0b487628340329a4bf0e5333b477b149c3 /t
parent24fbe004904f95ea07f22fea4e4c02a632149d73 (diff)
parent9eed4f3711a605ab2d9b986357879a09a6d54f36 (diff)
downloadgit-e6747627865347a534e7106bb1d14e32867b234d.zip
git-e6747627865347a534e7106bb1d14e32867b234d.tar.gz
git-e6747627865347a534e7106bb1d14e32867b234d.tar.bz2
Merge branch 'jk/push-force-with-lease-creation'
"git push --force-with-lease" already had enough logic to allow ensuring that such a push results in creation of a ref (i.e. the receiving end did not have another push from sideways that would be discarded by our force-pushing), but didn't expose this possibility to the users. It does so now. * jk/push-force-with-lease-creation: t5533: make it pass on case-sensitive filesystems push: allow pushing new branches with --force-with-lease push: add shorthand for --force-with-lease branch creation Documentation/git-push: fix placeholder formatting
Diffstat (limited to 't')
-rwxr-xr-xt/t5533-push-cas.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh
index c732012..a2c9e74 100755
--- a/t/t5533-push-cas.sh
+++ b/t/t5533-push-cas.sh
@@ -191,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