upload-pack: implement ref-in-want
authorBrandon Williams <bmwill@google.com>
Wed, 27 Jun 2018 22:30:17 +0000 (15:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Jun 2018 16:33:29 +0000 (09:33 -0700)
commit516e2b76bdcf53e757309481fa0e663217ee8039
treeae0e5dd4f8885a87ca8da1ecc740e34023ddd429
parent4bcd37d3bc436f202307897093d5ca162a688be2
upload-pack: implement ref-in-want

Currently, while performing packfile negotiation, clients are only
allowed to specify their desired objects using object ids.  This causes
a vulnerability to failure when an object turns non-existent during
negotiation, which may happen if, for example, the desired repository is
provided by multiple Git servers in a load-balancing arrangement and
there exists replication delay.

In order to eliminate this vulnerability, implement the ref-in-want
feature for the 'fetch' command in protocol version 2.  This feature
enables the 'fetch' command to support requests in the form of ref names
through a new "want-ref <ref>" parameter.  At the conclusion of
negotiation, the server will send a list of all of the wanted references
(as provided by "want-ref" lines) in addition to the generated packfile.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
Documentation/technical/protocol-v2.txt
t/t5703-upload-pack-ref-in-want.sh [new file with mode: 0755]
upload-pack.c