Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-12-22 18:14:13 +0300
committerJunio C Hamano <gitster@pobox.com>2022-12-25 10:24:24 +0300
commit738dc7d4a5f42376bc748008dd8792aa4eb25627 (patch)
treedadfd9fcff14ad1bc1fe4ba6876c97774664682c /bundle-uri.c
parent70b9c1037325ee82bc0832f4ca2d30c6ebf4808e (diff)
bundle-uri: serve bundle.* keys from config
Implement the "bundle-uri" protocol v2 capability by populating the key=value packet lines from the local Git config. The list of bundles is provided from the keys beginning with "bundle.". In the future, we may want to filter this list to be more specific to the exact known keys that the server intends to share, but for flexibility at the moment we will assume that the config values are well-formed. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle-uri.c')
-rw-r--r--bundle-uri.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/bundle-uri.c b/bundle-uri.c
index 28d8966005..26ff4b062d 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -581,6 +581,16 @@ cached:
return advertise_bundle_uri;
}
+static int config_to_packet_line(const char *key, const char *value, void *data)
+{
+ struct packet_reader *writer = data;
+
+ if (!strncmp(key, "bundle.", 7))
+ packet_write_fmt(writer->fd, "%s=%s", key, value);
+
+ return 0;
+}
+
int bundle_uri_command(struct repository *r,
struct packet_reader *request)
{
@@ -592,7 +602,11 @@ int bundle_uri_command(struct repository *r,
if (request->status != PACKET_READ_FLUSH)
die(_("bundle-uri: expected flush after arguments"));
- /* TODO: Implement the communication */
+ /*
+ * Read all "bundle.*" config lines to the client as key=value
+ * packet lines.
+ */
+ git_config(config_to_packet_line, &writer);
packet_writer_flush(&writer);