From 7cce9074a728fb32501054577963d8ae31d007be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 22 Dec 2022 15:14:10 +0000 Subject: bundle-uri client: add boolean transfer.bundleURI setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The yet-to-be introduced client support for bundle-uri will always fall back on a full clone, but we'd still like to be able to ignore a server's bundle-uri advertisement entirely. The new transfer.bundleURI config option defaults to 'false', but a user can set it to 'true' to enable checking for bundle URIs from the origin Git server using protocol v2. Co-authored-by: Derrick Stolee Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- transport.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'transport.c') diff --git a/transport.c b/transport.c index b6f279e92c..b4cf2c0252 100644 --- a/transport.c +++ b/transport.c @@ -1516,6 +1516,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs) int transport_get_remote_bundle_uri(struct transport *transport) { + int value = 0; const struct transport_vtable *vtable = transport->vtable; /* Check config only once. */ @@ -1523,6 +1524,13 @@ int transport_get_remote_bundle_uri(struct transport *transport) return 0; transport->got_remote_bundle_uri = 1; + /* + * Don't request bundle-uri from the server unless configured to + * do so by the transfer.bundleURI=true config option. + */ + if (git_config_get_bool("transfer.bundleuri", &value) || !value) + return 0; + if (!vtable->get_bundle_uri) return error(_("bundle-uri operation not supported by protocol")); -- cgit v1.2.3