aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-06-03 13:11:11 -0700
committerJunio C Hamano <gitster@pobox.com>2024-06-03 13:11:12 -0700
commiteb6392fb4f10ea627cf5f62740cf399e21378c9f (patch)
treeba8223e1cc72416f4e8e6adf6c36aa49b0399fdb /t
parent5c7c063c1f2b862d4d91b2230fc064dd9cf2d414 (diff)
parent6549c41ead833c8d8c4098806a29399433065516 (diff)
downloadgit-eb6392fb4f10ea627cf5f62740cf399e21378c9f.tar.gz
Merge branch 'th/push-local-ff-check-without-lazy-fetch'
When "git push" notices that the commit at the tip of the ref on the other side it is about to overwrite does not exist locally, it used to first try fetching it if the local repository is a partial clone. The command has been taught not to do so and immediately fail instead. * th/push-local-ff-check-without-lazy-fetch: push: don't fetch commit object when checking existence
Diffstat (limited to 't')
-rwxr-xr-xt/t0410-partial-clone.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 88a66f0904..7797391c03 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -689,6 +689,25 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
! grep "[?]$FILE_HASH" out
'
+test_expect_success 'push should not fetch new commit objects' '
+ rm -rf server client &&
+ test_create_repo server &&
+ test_config -C server uploadpack.allowfilter 1 &&
+ test_config -C server uploadpack.allowanysha1inwant 1 &&
+ test_commit -C server server1 &&
+
+ git clone --filter=blob:none "file://$(pwd)/server" client &&
+ test_commit -C client client1 &&
+
+ test_commit -C server server2 &&
+ COMMIT=$(git -C server rev-parse server2) &&
+
+ test_must_fail git -C client push 2>err &&
+ grep "fetch first" err &&
+ git -C client rev-list --objects --missing=print "$COMMIT" >objects &&
+ grep "^[?]$COMMIT" objects
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd