summaryrefslogtreecommitdiff
path: root/t/t5533-push-cas.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-04-19 09:22:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-20 01:53:06 (GMT)
commitf17d642d3b0fa64879d59b311e596949f2a1f6d2 (patch)
treedf003ca2ee3da78cd623fb4baef92a7a2934c3d5 /t/t5533-push-cas.sh
parent49800c940790cc7465d1b03e08d472ffd8684808 (diff)
downloadgit-f17d642d3b0fa64879d59b311e596949f2a1f6d2.zip
git-f17d642d3b0fa64879d59b311e596949f2a1f6d2.tar.gz
git-f17d642d3b0fa64879d59b311e596949f2a1f6d2.tar.bz2
push: document & test --force-with-lease with multiple remotes
Document & test for cases where there are two remotes pointing to the same URL, and a background fetch & subsequent `git push --force-with-lease` shouldn't clobber un-updated references we haven't fetched. Some editors like Microsoft's VSC have a feature to auto-fetch in the background, this bypasses the protections offered by --force-with-lease & --force-with-lease=<refname>, as noted in the documentation being added here. See the 'Tools that do an automatic fetch defeat "git push --force-with-lease"' (<1491617750.2149.10.camel@mattmccutchen.net>) git mailing list thread for more details. Jakub Narębski suggested this method of adding another remote to bypass this edge case, document that & add a test for it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5533-push-cas.sh')
-rwxr-xr-xt/t5533-push-cas.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh
index a2c9e74..d38ecee 100755
--- a/t/t5533-push-cas.sh
+++ b/t/t5533-push-cas.sh
@@ -229,4 +229,33 @@ test_expect_success 'new branch already exists' '
)
'
+test_expect_success 'background updates of REMOTE can be mitigated with a non-updated REMOTE-push' '
+ rm -rf src dst &&
+ git init --bare src.bare &&
+ test_when_finished "rm -rf src.bare" &&
+ git clone --no-local src.bare dst &&
+ test_when_finished "rm -rf dst" &&
+ (
+ cd dst &&
+ test_commit G &&
+ git remote add origin-push ../src.bare &&
+ git push origin-push master:master
+ ) &&
+ git clone --no-local src.bare dst2 &&
+ test_when_finished "rm -rf dst2" &&
+ (
+ cd dst2 &&
+ test_commit H &&
+ git push
+ ) &&
+ (
+ cd dst &&
+ test_commit I &&
+ git fetch origin &&
+ test_must_fail git push --force-with-lease origin-push &&
+ git fetch origin-push &&
+ git push --force-with-lease origin-push
+ )
+'
+
test_done