summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-08-01 11:07:35 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-01 11:07:35 -0700
commit35e22d54ed3ee237a88c8e7ddeae7f1305011830 (patch)
tree1421aee105aa674d606ffe58891e38b8a2b0f41d /fetch-pack.c
parentnegotiator/skipping: skip commits during fetch (diff)
parentfetch-pack: support negotiation tip whitelist (diff)
downloadtgif-35e22d54ed3ee237a88c8e7ddeae7f1305011830.tar.xz
Merge branch 'jt/fetch-nego-tip' into ab/fetch-nego
* jt/fetch-nego-tip: fetch-pack: support negotiation tip whitelist
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 786e2ee1b2..50773fdde3 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -214,6 +214,22 @@ static int next_flush(int stateless_rpc, int count)
return count;
}
+static void mark_tips(struct fetch_negotiator *negotiator,
+ const struct oid_array *negotiation_tips)
+{
+ int i;
+
+ if (!negotiation_tips) {
+ for_each_ref(rev_list_insert_ref_oid, negotiator);
+ return;
+ }
+
+ for (i = 0; i < negotiation_tips->nr; i++)
+ rev_list_insert_ref(negotiator, NULL,
+ &negotiation_tips->oid[i]);
+ return;
+}
+
static int find_common(struct fetch_negotiator *negotiator,
struct fetch_pack_args *args,
int fd[2], struct object_id *result_oid,
@@ -231,7 +247,7 @@ static int find_common(struct fetch_negotiator *negotiator,
if (args->stateless_rpc && multi_ack == 1)
die(_("--stateless-rpc requires multi_ack_detailed"));
- for_each_ref(rev_list_insert_ref_oid, negotiator);
+ mark_tips(negotiator, args->negotiation_tips);
for_each_cached_alternate(negotiator, insert_one_alternate_object);
fetching = 0;
@@ -1296,7 +1312,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
else
state = FETCH_SEND_REQUEST;
- for_each_ref(rev_list_insert_ref_oid, &negotiator);
+ mark_tips(&negotiator, args->negotiation_tips);
for_each_cached_alternate(&negotiator,
insert_one_alternate_object);
break;