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>