path: root/fetch-pack.c
diff options
authorJonathan Tan <>2018-12-18 21:24:35 (GMT)
committerJunio C Hamano <>2019-01-10 22:53:49 (GMT)
commit5056cf4a62338c013a723e37cbe1f525f1dcc29d (patch)
tree0e9a317a921307c77ccb12ab63ebf21fe7527ead /fetch-pack.c
parentbd0b42aed3084bf66557485fd7d87e975a4f6d4e (diff)
upload-pack: teach deepen-relative in protocol v2
Commit 685fbd3291 ("fetch-pack: perform a fetch using v2", 2018-03-15) attempted to teach Git deepen-relative in protocol v2 (among other things), but it didn't work: (1) fetch-pack.c needs to emit "deepen-relative". (2) upload-pack.c needs to ensure that the correct deepen_relative variable is passed to deepen() (there are two - the static variable and the one in struct upload_pack_data). (3) Before deepen() computes the list of reachable shallows, it first needs to mark all "our" refs as OUR_REF. v2 currently does not do this, because unlike v0, it is not needed otherwise. Fix all this and include a test demonstrating that it works now. For (2), the static variable deepen_relative is also eliminated, removing a source of confusion. Signed-off-by: Jonathan Tan <> Reviewed-by: Josh Steadmon <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'fetch-pack.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 5885623..577faa6 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1007,6 +1007,8 @@ static void add_shallow_requests(struct strbuf *req_buf,
packet_buf_write(req_buf, "deepen-not %s", s->string);
+ if (args->deepen_relative)
+ packet_buf_write(req_buf, "deepen-relative\n");
static void add_wants(int no_dependents, const struct ref *wants, struct strbuf *req_buf)