Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2020-04-28 03:01:09 +0300
committerJunio C Hamano <gitster@pobox.com>2020-04-28 19:55:02 +0300
commit4fa3f00abb55c3334cce71e201a5ff2c70f8561f (patch)
tree8cb45d844590a141325bf1822f2e5a285a24dc70 /t/t5500-fetch-pack.sh
parentd1185aa6fab2c12016e92ac9b9e448984cdc6c5d (diff)
fetch-pack: in protocol v2, in_vain only after ACK
When fetching, Git stops negotiation when it has sent at least MAX_IN_VAIN (which is 256) "have" lines without having any of them ACK-ed. But this is supposed to trigger only after the first ACK, as pack-protocol.txt says: However, the 256 limit *only* turns on in the canonical client implementation if we have received at least one "ACK %s continue" during a prior round. This helps to ensure that at least one common ancestor is found before we give up entirely. The code path for protocol v0 observes this, but not protocol v2, resulting in shorter negotiation rounds but significantly larger packfiles. Teach the code path for protocol v2 to check this criterion only after at least one ACK was received. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5500-fetch-pack.sh')
-rwxr-xr-xt/t5500-fetch-pack.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 6b97923964..95ed08db1b 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -385,6 +385,24 @@ test_expect_success 'clone shallow with packed refs' '
test_cmp count8.expected count8.actual
'
+test_expect_success 'in_vain not triggered before first ACK' '
+ rm -rf myserver myclient trace &&
+ git init myserver &&
+ test_commit -C myserver foo &&
+ git clone "file://$(pwd)/myserver" myclient &&
+
+ # MAX_IN_VAIN is 256. Because of batching, the client will send 496
+ # (16+32+64+128+256) commits, not 256, before giving up. So create 496
+ # irrelevant commits.
+ test_commit_bulk -C myclient 496 &&
+
+ # The new commit that the client wants to fetch.
+ test_commit -C myserver bar &&
+
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C myclient fetch --progress origin &&
+ test_i18ngrep "Total 3 " trace
+'
+
test_expect_success 'fetch in shallow repo unreachable shallow objects' '
(
git clone --bare --branch B --single-branch "file://$(pwd)/." no-reflog &&