]> source.dussan.org Git - jgit.git/commit
Protocol V2: respect MAX_HAVES only once we got at least one ACK 95/174195/3
authorThomas Wolf <thomas.wolf@paranor.ch>
Sun, 3 Jan 2021 22:07:18 +0000 (23:07 +0100)
committerThomas Wolf <thomas.wolf@paranor.ch>
Mon, 4 Jan 2021 09:00:28 +0000 (10:00 +0100)
commit0d7d98620f3c521d0471db888b1c7734f0f44eff
treeea9c068a7c07782fea9383ecf80bc9dea254605b
parentd9143287b778deba259cdd9d7db0a6aaba558eb2
Protocol V2: respect MAX_HAVES only once we got at least one ACK

The negotiation in the git protocol contains a cutoff: if the client
has sent more than MAX_HAVES "have" lines without getting an ACK, it
gives up and sends a "done". MAX_HAVES is 256.

However, this cutoff must kick in only if at least one ACK has been
received. Otherwise the client may give up way too early, which makes
the server send all its history. See [1].

This was missed when protocol V2 was implemented for fetching in JGit
in commit 0853a241.

Compare also C git commit 0b07eecf6ed.[2] C git had the same bug.[3][4]

[1] https://github.com/git/git/blob/6c430a647cb9/Documentation/technical/pack-protocol.txt#L385
[2] https://github.com/git/git/commit/0b07eecf6ed
[3] https://lore.kernel.org/git/b7f5bfb9-61fb-2552-4399-b744428728e4@suse.cz/
[4] https://lore.kernel.org/git/20200422084254.GA27502@furthur.local/

Bug: 553083
Change-Id: I1f4e2cc16b5eed6971d981d472329185abb9e4a9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java