summaryrefslogtreecommitdiffstats
path: root/transport.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-12-22 16:14:10 +0100
committerJunio C Hamano <gitster@pobox.com>2022-12-25 08:24:23 +0100
commit7cce9074a728fb32501054577963d8ae31d007be (patch)
tree8400b171dac2d810bc62463b029fd29bf734b2e4 /transport.c
parentclone: request the 'bundle-uri' command when available (diff)
downloadgit-7cce9074a728fb32501054577963d8ae31d007be.tar.xz
git-7cce9074a728fb32501054577963d8ae31d007be.zip
bundle-uri client: add boolean transfer.bundleURI setting
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 <derrickstolee@github.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--transport.c8
1 files changed, 8 insertions, 0 deletions
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"));