wrapper.c: add and use warn_on_fopen_errors()
[gitweb.git] / t / t5533-push-cas.sh
index ed631c3d0b65a1b5daf7fac1dbb3ce951d2e2777..d38ecee2172a6e5599cfbeb18e472816e98e553c 100755 (executable)
@@ -191,6 +191,18 @@ 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 &&
        (
@@ -208,7 +220,7 @@ test_expect_success 'new branch already exists' '
        (
                cd src &&
                git checkout -b branch master &&
-               test_commit c
+               test_commit F
        ) &&
        (
                cd dst &&
@@ -217,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