* [PATCH 0/3] Fix promisor-remote reply missing from fetch
@ 2026-11-12 19:58 Christian Couder
2026-11-12 19:59 ` [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply Christian Couder
` (3 more replies)
0 siblings, 4 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-12 19:58 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
This small series fixes a brown paper bag bug in the "promisor-remote"
protocol v2 capability found by Matt Cote during the NVIDIA hackathon
following the Gerrit User Summit 2026.
The client doesn't send a "promisor-remote=..." reply with the `fetch`
protocol commands. It does send such a reply with the `ls-refs` and
`bundle-uri` protocol commands. So this works by luck with a Git
server over file:// or ssh://, as the same `upload-pack` process
handles all the requests and remembers the reply from `ls-refs`.
But it doesn't work with servers that handle each request on its own,
like Git over HTTP or JGit (so Gerrit). It also doesn't work when only
object IDs are fetched, as no `ls-refs` is sent then.
In these cases, the server doesn't know that the client accepted a
promisor remote, so it doesn't allow the objects available on the
accepted promisor remotes to be missing from the pack, and fails with
"could not fetch <oid> from promisor remote".
This has been the case since the capability was introduced in v2.49,
so it would be nice to have the fix in maint too.
Other related issues were found during the hackathon, but this one is
the most annoying. The others will be addressed in separate series.
Overview of the patches
=======================
- Patch 1/3 lets write_command_and_capabilities() send a
promisor-remote reply, without any change in behavior.
- Patch 2/3 is the actual fix, with new tests in t5710, and in a new
t5711 test script for HTTP.
- Patch 3/3 documents that the client should send the reply with
`fetch`.
CI tests
========
Some failed, others didn't even started, see:
https://github.com/chriscool/git/actions/runs/43285535901
But the failures all seem related to the test infrastructure.
Christian Couder (3):
connect: let write_command_and_capabilities() send a promisor-remote
reply
fetch-pack: ensure fetch sends a promisor-remote reply
doc: gitprotocol-v2: send the promisor-remote reply with fetch
Documentation/gitprotocol-v2.adoc | 6 +
connect.c | 6 +-
connect.h | 6 +-
fetch-object-info.c | 3 +-
fetch-pack.c | 17 ++-
t/meson.build | 1 +
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 +++++++++++++++++++++
8 files changed, 196 insertions(+), 9 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
base-commit: 1891de46f79dc444a47db1c87bd0c8c76b5463f2
--
2.56.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-12 19:58 [PATCH 0/3] Fix promisor-remote reply missing from fetch Christian Couder
@ 2026-11-12 19:59 ` Christian Couder
2026-11-12 22:18 ` Junio C Hamano
2026-11-12 19:59 ` [PATCH 2/3] fetch-pack: ensure fetch sends " Christian Couder
` (2 subsequent siblings)
3 siblings, 1 reply; 18+ messages in thread
From: Christian Couder @ 2026-11-12 19:59 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
In protocol v2, the `promisor-remote=...` reply is only written by
send_capabilities(), which is used to send the `ls-refs` and
`bundle-uri` protocol commands.
The request for the `fetch` protocol command is built by
write_command_and_capabilities() called by send_fetch_request() in
"fetch-pack.c" which cannot send that reply.
In a following commit, we will need send_fetch_request() to send that
reply.
Let's prepare for that by adding a new `promisor_remote_reply` argument
to write_command_and_capabilities(). When it is not NULL, a
`promisor-remote=...` capability with that value is written into the
request.
For now, all the callers pass NULL, so there is no change in behavior.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 6 +++++-
connect.h | 6 ++++--
fetch-object-info.c | 3 ++-
fetch-pack.c | 6 ++++--
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/connect.c b/connect.c
index 87d2e8bccd..32243948b4 100644
--- a/connect.c
+++ b/connect.c
@@ -724,7 +724,8 @@ int server_supports(const char *feature)
}
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct string_list *server_options)
+ const struct string_list *server_options,
+ const char *promisor_remote_reply)
{
const char *hash_name;
int advertise_sid = 0;
@@ -754,6 +755,9 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
die(_("the server does not support algorithm '%s'"),
the_hash_algo->name);
}
+ if (promisor_remote_reply)
+ packet_buf_write(req_buf, "promisor-remote=%s",
+ promisor_remote_reply);
packet_buf_delim(req_buf);
}
diff --git a/connect.h b/connect.h
index 957e5fe2b9..8914d131c7 100644
--- a/connect.h
+++ b/connect.h
@@ -37,9 +37,11 @@ void check_stateless_delimiter(int stateless_rpc,
struct string_list;
/*
* Write a protocol v2 command request, along with the capability
- * advertisements, into req_buf.
+ * advertisements, into req_buf. When `promisor_remote_reply` is not
+ * NULL, a `promisor-remote` capability is sent with that value.
*/
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct string_list *server_options);
+ const struct string_list *server_options,
+ const char *promisor_remote_reply);
#endif
diff --git a/fetch-object-info.c b/fetch-object-info.c
index 0a58308f9b..7fe6e4e864 100644
--- a/fetch-object-info.c
+++ b/fetch-object-info.c
@@ -18,7 +18,8 @@ static void send_object_info_request(const int fd_out,
{
struct strbuf req_buf = STRBUF_INIT;
- write_command_and_capabilities(&req_buf, "object-info", server_options);
+ write_command_and_capabilities(&req_buf, "object-info",
+ server_options, NULL);
if (ask_size)
packet_buf_write(&req_buf, "size");
diff --git a/fetch-pack.c b/fetch-pack.c
index 55d311c0c3..50c97f561e 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1386,7 +1386,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
int done_sent = 0;
struct strbuf req_buf = STRBUF_INIT;
- write_command_and_capabilities(&req_buf, "fetch", args->server_options);
+ write_command_and_capabilities(&req_buf, "fetch",
+ args->server_options, NULL);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
@@ -2269,7 +2270,8 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
the_repository, "%d",
negotiation_round);
strbuf_reset(&req_buf);
- write_command_and_capabilities(&req_buf, "fetch", server_options);
+ write_command_and_capabilities(&req_buf, "fetch",
+ server_options, NULL);
packet_buf_write(&req_buf, "wait-for-done");
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] fetch-pack: ensure fetch sends a promisor-remote reply
2026-11-12 19:58 [PATCH 0/3] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-12 19:59 ` [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply Christian Couder
@ 2026-11-12 19:59 ` Christian Couder
2026-11-12 19:59 ` [PATCH 3/3] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
3 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-12 19:59 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
In protocol v2, when the client accepts promisor remotes, the
`promisor-remote=...` reply is only written by send_capabilities(),
which is used to send the `ls-refs` and `bundle-uri` protocol commands.
The request for the `fetch` protocol command is built by
write_command_and_capabilities() called by send_fetch_request() in
"fetch-pack.c" which doesn't send that reply. do_fetch_pack_v2() calls
promisor_remote_reply(), but only to mark the accepted remotes, as
e15a6b2f8b (promisor-remote: change promisor_remote_reply()'s
signature, 2026-02-16) assumed that fetch-pack would not need to send
a reply.
With file:// and ssh:// URLs on a Git server, one upload-pack process
handles both `ls-refs` and `fetch`. The acceptance recorded during
`ls-refs` by promisor_remote_receive() in "serve.c" is still there at
`fetch` time, so the clone succeeds. But it fails when each request is
handled on its own, for example with HTTP where different upload-pack
processes are used, or with other server implementations like JGit.
It also fails when only object IDs are fetched, as no `ls-refs`
command is then sent. In these cases, the server doesn't know that the
client accepted a promisor remote, so it doesn't allow promisor
objects to be missing from the pack it sends, and it fails with "could
not fetch <oid> from promisor remote".
Let's fix that by always properly sending the `promisor-remote=...`
reply when sending a `fetch` request from do_fetch_pack_v2().
The `fetch` requests sent by negotiate_using_fetch() don't ask for a
pack, so they don't need that reply.
Let's also add tests in t5710 to check that the reply is sent with the
`fetch` request, and that fetching only an object ID works. For HTTP,
let's add a new t5711 test script, copying the setup from t5710.
Reported-by: Matt Cote <mcote@nvidia.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
fetch-pack.c | 13 ++-
t/meson.build | 1 +
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 +++++++++++++++++++++
4 files changed, 176 insertions(+), 4 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
diff --git a/fetch-pack.c b/fetch-pack.c
index 50c97f561e..2f1bb9d62c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1380,14 +1380,16 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
const struct ref *wants, struct oidset *common,
int *haves_to_send, int *in_vain,
int sideband_all, int seen_ack,
- struct oidset *negotiation_include_oids)
+ struct oidset *negotiation_include_oids,
+ const char *promisor_remote_reply)
{
int haves_added;
int done_sent = 0;
struct strbuf req_buf = STRBUF_INIT;
write_command_and_capabilities(&req_buf, "fetch",
- args->server_options, NULL);
+ args->server_options,
+ promisor_remote_reply);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
@@ -1696,11 +1698,12 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
int i;
struct strvec index_pack_args = STRVEC_INIT;
const char *promisor_remote_config;
+ char *accepted = NULL;
fsck_options_init(&fsck_options, the_repository, FSCK_OPTIONS_MISSING_GITMODULES);
if (server_feature_v2("promisor-remote", &promisor_remote_config))
- promisor_remote_reply(promisor_remote_config, NULL);
+ promisor_remote_reply(promisor_remote_config, &accepted);
if (args->filter_options.choice == LOFC_AUTO) {
struct strbuf errbuf = STRBUF_INIT;
@@ -1778,7 +1781,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
&haves_to_send, &in_vain,
reader.use_sideband,
seen_ack,
- &negotiation_include_oids)) {
+ &negotiation_include_oids,
+ accepted)) {
trace2_region_leave_printf("negotiation_v2", "round",
the_repository, "%d",
negotiation_round);
@@ -1928,6 +1932,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
if (negotiator)
negotiator->release(negotiator);
+ free(accepted);
fsck_options_clear(&fsck_options);
oidset_clear(&common);
oidset_clear(&negotiation_include_oids);
diff --git a/t/meson.build b/t/meson.build
index 1cf1d95f70..84644703f1 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -766,6 +766,7 @@ integration_tests = [
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
't5710-promisor-remote-capability.sh',
+ 't5711-promisor-remote-capability-http.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh
index 463e9e00b0..e5d6f9d1c6 100755
--- a/t/t5710-promisor-remote-capability.sh
+++ b/t/t5710-promisor-remote-capability.sh
@@ -999,6 +999,46 @@ test_expect_success "clone and fetch with --filter=auto" '
check_missing_objects server 1 "$oid"
'
+test_expect_success "clone sends the promisor-remote reply with fetch" '
+ git -C server config promisor.advertise true &&
+ test_when_finished "rm -rf client trace" &&
+
+ GIT_TRACE_PACKET="$(pwd)/trace" git clone \
+ -c remote.lop.promisor=true \
+ -c remote.lop.url="$TRASH_DIRECTORY_URL/lop" \
+ -c promisor.acceptfromserver=All \
+ --no-local --filter="blob:limit=5k" server client &&
+
+ # Check that the reply is part of the fetch request
+ sed -n "/clone> command=fetch/,/clone> 0001/p" trace >request &&
+ test_grep "clone> promisor-remote=lop" request &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects server 1 "$oid"
+'
+
+test_expect_success "fetch by object ID sends the promisor-remote reply" '
+ git -C server config promisor.advertise true &&
+ test_when_finished "rm -rf client trace" &&
+
+ git init client &&
+ git -C client remote add origin "$TRASH_DIRECTORY_URL/server" &&
+ git -C client config remote.lop.promisor true &&
+ git -C client config remote.lop.url "$TRASH_DIRECTORY_URL/lop" &&
+ git -C client config promisor.acceptfromserver All &&
+
+ # Fetching only an object ID skips the "ls-refs" command, so the
+ # reply can only be sent with "fetch"
+ head=$(git -C server rev-parse HEAD) &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch --no-tags \
+ --filter="blob:limit=5k" origin "$head" &&
+ test_grep ! "fetch> command=ls-refs" trace &&
+ test_grep "fetch> promisor-remote=lop" trace &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects server 1 "$oid"
+'
+
test_expect_success "clone with promisor.advertise set to 'true' but don't delete the client" '
git -C server config promisor.advertise true &&
diff --git a/t/t5711-promisor-remote-capability-http.sh b/t/t5711-promisor-remote-capability-http.sh
new file mode 100755
index 0000000000..c08cca3e51
--- /dev/null
+++ b/t/t5711-promisor-remote-capability-http.sh
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+test_description='handling of promisor remote advertisement over HTTP'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PERL_TEST_HELPERS
+then
+ skip_all='skipping promisor remote capabilities tests; Perl not available'
+ test_done
+fi
+
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+GIT_TEST_MULTI_PACK_INDEX=0
+GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0
+
+# The setup and helpers below are copied from t5710, except that the
+# server repository is in the HTTP document root.
+
+SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server.git"
+
+check_missing_objects () {
+ git -C "$1" rev-list --objects --all --missing=print > all.txt &&
+ perl -ne 'print if s/^[?]//' all.txt >missing.txt &&
+ test_line_count = "$2" missing.txt &&
+ test "$3" = "$(cat missing.txt)"
+}
+
+initialize_server () {
+ # Repack everything first
+ git -C "$SERVER" -c repack.writebitmaps=false repack -a -d &&
+
+ # Repack without the largest object and create a promisor pack on server
+ git -C "$SERVER" -c repack.writebitmaps=false repack -a -d \
+ --filter=blob:limit=5k --filter-to="$(pwd)/pack" &&
+ promisor_file=$(ls "$SERVER"/objects/pack/*.pack | sed "s/\.pack/.promisor/") &&
+ >"$promisor_file" &&
+
+ # Check objects missing on the server
+ check_missing_objects "$SERVER" 1 "$1"
+}
+
+copy_to_lop () {
+ oid_path="$(test_oid_to_path $1)" &&
+ path="$SERVER/objects/$oid_path" &&
+ path2="lop/objects/$oid_path" &&
+ mkdir -p $(dirname "$path2") &&
+ cp "$path" "$path2"
+}
+
+# On Windows, `pwd` returns a path like 'D:/foo/bar'. Prepend '/' to turn
+# it into '/D:/foo/bar', which is what git expects in file:// URLs on Windows.
+# On Unix, the path already starts with '/', so this is a no-op.
+pwd_path=$(pwd)
+case "$pwd_path" in
+[a-zA-Z]:*) pwd_path="/$pwd_path" ;;
+esac
+
+TRASH_DIRECTORY_URL="file://$pwd_path"
+
+test_expect_success 'setup: create "template" repository' '
+ git init template &&
+ test_commit -C template 1 &&
+ test_commit -C template 2 &&
+ test_commit -C template 3 &&
+ test-tool genrandom foo 10k >template/foo &&
+ git -C template add foo &&
+ git -C template commit -m foo
+'
+
+# A bare repo will act as a server repo with unpacked objects.
+test_expect_success 'setup: create bare "server" repository' '
+ git clone --bare --no-local template "$SERVER" &&
+ mv "$SERVER"/objects/pack/pack-* . &&
+ packfile=$(ls pack-*.pack) &&
+ git -C "$SERVER" unpack-objects --strict <"$packfile"
+'
+
+test_expect_success "setup for testing promisor remote advertisement" '
+ # Create another bare repo called "lop" (for Large Object Promisor)
+ git init --bare lop &&
+
+ # Copy the largest object from server to lop
+ obj="HEAD:foo" &&
+ oid="$(git -C "$SERVER" rev-parse $obj)" &&
+ copy_to_lop "$oid" &&
+
+ initialize_server "$oid" &&
+
+ # Configure lop as promisor remote for server
+ git -C "$SERVER" remote add lop "$TRASH_DIRECTORY_URL/lop" &&
+ git -C "$SERVER" config remote.lop.promisor true &&
+
+ git -C lop config uploadpack.allowFilter true &&
+ git -C lop config uploadpack.allowAnySHA1InWant true &&
+ git -C "$SERVER" config uploadpack.allowFilter true &&
+ git -C "$SERVER" config uploadpack.allowAnySHA1InWant true &&
+ git -C "$SERVER" config promisor.advertise true
+'
+
+# Over HTTP, each request is handled by a separate upload-pack process,
+# so the server knows that the client accepted "lop" only if the reply
+# is sent with the "fetch" request itself.
+test_expect_success "clone over HTTP with an accepted promisor remote" '
+ test_when_finished "rm -rf client trace" &&
+
+ GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 clone \
+ -c remote.lop.promisor=true \
+ -c remote.lop.url="$TRASH_DIRECTORY_URL/lop" \
+ -c promisor.acceptfromserver=All \
+ --filter="blob:limit=5k" "$HTTPD_URL/smart/server.git" client &&
+
+ # Check that the reply is part of the fetch request
+ sed -n "/clone> command=fetch/,/clone> 0001/p" trace >request &&
+ test_grep "clone> promisor-remote=lop" request &&
+
+ # Check that the largest object was lazily fetched from lop
+ test_cmp template/foo client/foo &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects "$SERVER" 1 "$oid"
+'
+
+test_done
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] doc: gitprotocol-v2: send the promisor-remote reply with fetch
2026-11-12 19:58 [PATCH 0/3] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-12 19:59 ` [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply Christian Couder
2026-11-12 19:59 ` [PATCH 2/3] fetch-pack: ensure fetch sends " Christian Couder
@ 2026-11-12 19:59 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
3 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-12 19:59 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
Until a previous commit, a client sent its `promisor-remote=...` reply
only with the `ls-refs` and `bundle-uri` protocol commands.
Let's clearly document that the client should send that reply with the
`fetch` command request too.
Reported-by: Matt Cote <mcote@nvidia.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
Documentation/gitprotocol-v2.adoc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/gitprotocol-v2.adoc b/Documentation/gitprotocol-v2.adoc
index dd52fd8110..b8732173cd 100644
--- a/Documentation/gitprotocol-v2.adoc
+++ b/Documentation/gitprotocol-v2.adoc
@@ -879,6 +879,12 @@ In this case, or if the client doesn't want to use any promisor remote
the server advertised, the client shouldn't advertise the
"promisor-remote" capability at all in its reply.
+As protocol v2 is stateless (see the "Capabilities" section above),
+the client should send this reply with the `fetch` command request,
+even if it has already sent it with an earlier command request, like
+`ls-refs`. Note that when only some object IDs are fetched, the client
+might not send any `ls-refs` command request at all.
+
On the server side, the "promisor.advertise" and "promisor.sendFields"
configuration options can be used to control what it advertises. On
the client side, the "promisor.acceptFromServer" and
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-12 19:59 ` [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply Christian Couder
@ 2026-11-12 22:18 ` Junio C Hamano
2026-11-12 22:34 ` Junio C Hamano
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2026-11-12 22:18 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Patrick Steinhardt, Matt Cote
Christian Couder <christian.couder@gmail.com> writes:
> void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
> - const struct string_list *server_options)
> + const struct string_list *server_options,
> + const char *promisor_remote_reply)
> {
> const char *hash_name;
> int advertise_sid = 0;
> @@ -754,6 +755,9 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
> die(_("the server does not support algorithm '%s'"),
> the_hash_algo->name);
> }
> + if (promisor_remote_reply)
> + packet_buf_write(req_buf, "promisor-remote=%s",
> + promisor_remote_reply);
> packet_buf_delim(req_buf);
> }
This function was designed to have a fairly generic "here we send a
command and then capability exchange based on the settings stored in
the string list" interface for extensibility. It is highly annoying
that we are now adding a specific option here to be sent outside the
framework.
Isn't the misdesign being corrected that the "promisor-remote=..."
string was not sent as part of these server options list of strings?
Can we fix it without contaminating the API like this patch does, or
is it too late?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-12 22:18 ` Junio C Hamano
@ 2026-11-12 22:34 ` Junio C Hamano
2026-11-13 13:10 ` Christian Couder
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2026-11-12 22:34 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Patrick Steinhardt, Matt Cote
Junio C Hamano <gitster@pobox.com> writes:
> Christian Couder <christian.couder@gmail.com> writes:
>
>> void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
>> - const struct string_list *server_options)
>> + const struct string_list *server_options,
>> + const char *promisor_remote_reply)
>> {
>> const char *hash_name;
>> int advertise_sid = 0;
>> @@ -754,6 +755,9 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
>> die(_("the server does not support algorithm '%s'"),
>> the_hash_algo->name);
>> }
>> + if (promisor_remote_reply)
>> + packet_buf_write(req_buf, "promisor-remote=%s",
>> + promisor_remote_reply);
>> packet_buf_delim(req_buf);
>> }
>
> This function was designed to have a fairly generic "here we send a
> command and then capability exchange based on the settings stored in
> the string list" interface for extensibility. It is highly annoying
> that we are now adding a specific option here to be sent outside the
> framework.
>
> Isn't the misdesign being corrected that the "promisor-remote=..."
> string was not sent as part of these server options list of strings?
> Can we fix it without contaminating the API like this patch does, or
> is it too late?
By this I do not mean that promisor-remote=... has to be sent as one
of the server options (i.e., making the string sent to something
silly like "server-option=promisor-remote=..."). Rather, I am
wondering if the existing server_options string list should be made
into a more generalized form so that the string list can contain
elements whose keys other than "server-option" can also be
contained (like "promisor-remote"). IOW, the caller can decide to
put "promisor-remote=...promisor remote reply..." in the list,
instead of sending it as a totally separate parameter, whose
semantics is hardcoded (i.e. the fourth parameter to this function
will be sent as a value to "promistor-remote=...").
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-12 22:34 ` Junio C Hamano
@ 2026-11-13 13:10 ` Christian Couder
2026-11-13 19:11 ` Junio C Hamano
0 siblings, 1 reply; 18+ messages in thread
From: Christian Couder @ 2026-11-13 13:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Patrick Steinhardt, Matt Cote
On Thu, Nov 12, 2026 at 11:34 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> > Christian Couder <christian.couder@gmail.com> writes:
> >
> >> void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
> >> - const struct string_list *server_options)
> >> + const struct string_list *server_options,
> >> + const char *promisor_remote_reply)
> >> {
> >> const char *hash_name;
> >> int advertise_sid = 0;
> >> @@ -754,6 +755,9 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
> >> die(_("the server does not support algorithm '%s'"),
> >> the_hash_algo->name);
> >> }
> >> + if (promisor_remote_reply)
> >> + packet_buf_write(req_buf, "promisor-remote=%s",
> >> + promisor_remote_reply);
> >> packet_buf_delim(req_buf);
> >> }
> >
> > This function was designed to have a fairly generic "here we send a
> > command and then capability exchange based on the settings stored in
> > the string list" interface for extensibility. It is highly annoying
> > that we are now adding a specific option here to be sent outside the
> > framework.
> >
> > Isn't the misdesign being corrected that the "promisor-remote=..."
> > string was not sent as part of these server options list of strings?
> > Can we fix it without contaminating the API like this patch does, or
> > is it too late?
I think that if we wanted to clean this up, it would need a
significant refactor as there are three separate places in "connect.c"
that write the client's protocol v2 capabilities:
- send_capabilities() used for `bundle-uri`,
- get_remote_refs() (using send_capabilities() and its own loop) used
for `ls-refs`,
- write_command_and_capabilities() used for `fetch` and `object-info`.
They duplicate code for sending "server-option", "agent" and
"object-format", while each sends a different set of capabilities.
The server side already has a table of capabilities (`capabilities[]`
in "serve.c") with generic advertise/receive handling. The client side
could have something similar for building requests.
> By this I do not mean that promisor-remote=... has to be sent as one
> of the server options (i.e., making the string sent to something
> silly like "server-option=promisor-remote=..."). Rather, I am
> wondering if the existing server_options string list should be made
> into a more generalized form so that the string list can contain
> elements whose keys other than "server-option" can also be
> contained (like "promisor-remote"). IOW, the caller can decide to
> put "promisor-remote=...promisor remote reply..." in the list,
> instead of sending it as a totally separate parameter, whose
> semantics is hardcoded (i.e. the fourth parameter to this function
> will be sent as a value to "promistor-remote=...").
I am willing to work on a significant refactoring along what you
suggest, but I think it should be a separate series from this bug fix
series, especially as we might want this fix to also go to maint.
In the meantime, I can send a v2 of this series with something like a
NEEDSWORK comment, for example one in front of
write_command_and_capabilities() saying that it should be refactored
with send_capabilities() and get_remote_refs(), so that callers build
the full list of capabilities, which would remove the
`promisor_remote_reply` parameter
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-13 13:10 ` Christian Couder
@ 2026-11-13 19:11 ` Junio C Hamano
2026-11-20 16:57 ` Christian Couder
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2026-11-13 19:11 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Patrick Steinhardt, Matt Cote
Christian Couder <christian.couder@gmail.com> writes:
> They duplicate code for sending "server-option", "agent" and
> "object-format", while each sends a different set of capabilities.
That is all the more reason to clean them up before we pile more
stuff on top, no?
I do not know if that deserves to be called "significant"
refactoring, though. It would not take a series with 20 patches
each of which weigh more than 30 lines touched, no?
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 0/8] Fix promisor-remote reply missing from fetch
2026-11-12 19:58 [PATCH 0/3] Fix promisor-remote reply missing from fetch Christian Couder
` (2 preceding siblings ...)
2026-11-12 19:59 ` [PATCH 3/3] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 1/8] connect: pass capability lines to write_command_and_capabilities() Christian Couder
` (7 more replies)
3 siblings, 8 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
This started as a small series to fix a brown paper bag bug in the
"promisor-remote" protocol v2 capability found by Matt Cote during the
NVIDIA hackathon following the Gerrit User Summit 2026.
But with this version 2, it has become more of a refactoring of the
code that clients use to write protocol v2 capabilities. That's
because there are three different places doing that in "connect.c":
- send_capabilities() used for `bundle-uri`,
- get_remote_refs() (using send_capabilities() and its own loop) used
for `ls-refs`,
- write_command_and_capabilities() used for `fetch` and `object-info`.
So a large part of this version 2 series refactors this, and now only
write_command_and_capabilities() does it.
The bug, which is addressed in the last two patches of the series, is
that the client doesn't send a "promisor-remote=..." reply with the
`fetch` protocol commands. It does send such a reply with the
`ls-refs` and `bundle-uri` protocol commands. So this works by luck
with a Git server over file:// or ssh://, as the same `upload-pack`
process handles all the requests and remembers the reply from
`ls-refs`.
But it doesn't work with servers that handle each request on its own,
like Git over HTTP. (This is also how it was found with a JGit/Gerrit
setup during the hackathon.) It also doesn't work when only object IDs
are fetched, as no `ls-refs` is sent then.
In these cases, the server doesn't know that the client accepted a
promisor remote, so it doesn't allow the objects available on the
accepted promisor remotes to be missing from the pack, and fails with
"could not fetch <oid> from promisor remote".
This has been the case since the capability was introduced in v2.49,
so it would be nice to have the fix in maint too. The series still
applies cleanly on top of maint (v2.56.1) and the tests pass there. As
the wire changes in the first part of the series are small (see
below), I hope the whole series can be considered for maint.
Other related issues were found during the NVIDIA hackathon, but this
one is the most annoying. The others will be addressed in separate
series.
Overview of the patches
=======================
- Patches 1/8 to 6/8 make write_command_and_capabilities() the only
function that writes protocol v2 capabilities. That function
becomes more generic, while helper functions are added for callers
to prepare capabilities before passing them to that function.
There are a few wire changes in those mostly refactoring patches,
to unify the behavior when sending different requests:
- patch 2/8 sends "session-id" with `ls-refs` and `bundle-uri`
requests (only when `transfer.advertiseSID` is set),
- patch 4/8 changes how failing to write `ls-refs` and
`bundle-uri` requests is reported, as we now die with "unable to
write request to remote", like for `fetch` and `object-info`
requests, instead of with "packet write with format failed" (or
silently from SIGPIPE on EPIPE),
- patches 5/8 and 6/8 change the order of the capability lines,
and "command=bundle-uri" now comes first,
- patches 5/8 and 6/8 also stop sending a trailing "\n" after
"command=ls-refs" and "command=bundle-uri".
- Patch 7/8 ("fetch-pack: ensure fetch sends a promisor-remote
reply") is the actual fix, with new tests in t5710, and in a new
t5711 test script for HTTP.
- Patch 8/8 ("doc: gitprotocol-v2: send the promisor-remote reply
with fetch") documents that the client should send the reply with
`fetch` requests asking for a pack.
Changes compared to v1
======================
Thanks to Junio for reviewing v1. As he suggested, callers now build
the list of capabilities they want to send and pass it to
write_command_and_capabilities(), instead of passing a specific
promisor-remote reply argument.
- Patches 1/8 to 6/8 are new. They replace patch 1/3 in v1 (which
only added a new `const char *promisor_remote_reply` argument to
write_command_and_capabilities() so that this function could send
a promisor-remote reply).
- Patch 7/8 now uses a new add_promisor_remote_reply() helper
function introduced by previous patches to prepare the
"promisor-remote" capability reply, and then always writes it with
the improved write_command_and_capabilities() when sending a
`fetch` request. The added tests are the same as in v1.
- Patch 8/8 now documents that the reply should be sent with each
`fetch` request asking for a pack (so not with negotiation-only
requests), and mentions `bundle-uri` along with `ls-refs`.
CI tests
========
Some failed, others didn't even start, see:
https://github.com/chriscool/git/actions/runs/44747276981
But all these issues look unrelated to this series.
Range-diff compared to v1
=========================
1: 523fec7fc3 < -: ---------- connect: let write_command_and_capabilities() send a promisor-remote reply
-: ---------- > 1: 0b8a469426 connect: pass capability lines to write_command_and_capabilities()
-: ---------- > 2: b5814012e7 connect: send session-id with ls-refs and bundle-uri
-: ---------- > 3: 9ae83a24d4 connect: pass a reader to write_command_and_capabilities()
-: ---------- > 4: b9393478d9 connect: buffer the ls-refs and bundle-uri requests
-: ---------- > 5: c7bb7aea1e connect: use write_command_and_capabilities() in get_remote_refs()
-: ---------- > 6: 6f8b694584 connect: use write_command_and_capabilities() in get_remote_bundle_uri()
2: 8e2294ec62 ! 7: d3ab977624 fetch-pack: ensure fetch sends a promisor-remote reply
@@ Commit message
fetch-pack: ensure fetch sends a promisor-remote reply
In protocol v2, when the client accepts promisor remotes, the
- `promisor-remote=...` reply is only written by send_capabilities(),
- which is used to send the `ls-refs` and `bundle-uri` protocol commands.
+ `promisor-remote=...` reply is only sent with the `ls-refs` and
+ `bundle-uri` protocol commands, by get_remote_refs() and
+ get_remote_bundle_uri() in "connect.c".
The request for the `fetch` protocol command is built by
- write_command_and_capabilities() called by send_fetch_request() in
- "fetch-pack.c" which doesn't send that reply. do_fetch_pack_v2() calls
- promisor_remote_reply(), but only to mark the accepted remotes, as
- e15a6b2f8b (promisor-remote: change promisor_remote_reply()'s
- signature, 2026-02-16) assumed that fetch-pack would not need to send
- a reply.
+ send_fetch_request() in "fetch-pack.c" which doesn't send that reply.
+ do_fetch_pack_v2() calls promisor_remote_reply(), but only to mark the
+ accepted remotes, as e15a6b2f8b (promisor-remote: change
+ promisor_remote_reply()'s signature, 2026-02-16) assumed that
+ fetch-pack would not need to send a reply.
With file:// and ssh:// URLs on a Git server, one upload-pack process
handles both `ls-refs` and `fetch`. The acceptance recorded during
`ls-refs` by promisor_remote_receive() in "serve.c" is still there at
`fetch` time, so the clone succeeds. But it fails when each request is
handled on its own, for example with HTTP where different upload-pack
- processes are used, or with other server implementations like JGit.
+ processes are used.
It also fails when only object IDs are fetched, as no `ls-refs`
command is then sent. In these cases, the server doesn't know that the
@@ Commit message
objects to be missing from the pack it sends, and it fails with "could
not fetch <oid> from promisor remote".
- Let's fix that by always properly sending the `promisor-remote=...`
- reply when sending a `fetch` request from do_fetch_pack_v2().
+ Let's fix that by building the list of capabilities for the `fetch`
+ requests once in do_fetch_pack_v2(), using add_server_options() and
+ add_promisor_remote_reply(), and by passing that list to
+ send_fetch_request(). This way the `promisor-remote=...` reply is
+ always properly sent with the `fetch` requests, and the accepted
+ remotes are still marked at the same point as before.
The `fetch` requests sent by negotiate_using_fetch() don't ask for a
pack, so they don't need that reply.
@@ fetch-pack.c: static int send_fetch_request(struct fetch_negotiator *negotiator,
int sideband_all, int seen_ack,
- struct oidset *negotiation_include_oids)
+ struct oidset *negotiation_include_oids,
-+ const char *promisor_remote_reply)
++ const struct strvec *capabilities)
{
int haves_added;
int done_sent = 0;
struct strbuf req_buf = STRBUF_INIT;
+- struct strvec capabilities = STRVEC_INIT;
+- add_server_options(&capabilities, args->server_options);
write_command_and_capabilities(&req_buf, "fetch",
-- args->server_options, NULL);
-+ args->server_options,
-+ promisor_remote_reply);
+- &capabilities, NULL);
++ capabilities, NULL);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
+@@ fetch-pack.c: static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
+ if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
+ die_errno(_("unable to write request to remote"));
+
+- strvec_clear(&capabilities);
+ strbuf_release(&req_buf);
+ return done_sent;
+ }
@@ fetch-pack.c: static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
+ struct string_list packfile_uris = STRING_LIST_INIT_DUP;
int i;
struct strvec index_pack_args = STRVEC_INIT;
- const char *promisor_remote_config;
-+ char *accepted = NULL;
+- const char *promisor_remote_config;
++ struct strvec capabilities = STRVEC_INIT;
fsck_options_init(&fsck_options, the_repository, FSCK_OPTIONS_MISSING_GITMODULES);
- if (server_feature_v2("promisor-remote", &promisor_remote_config))
+- if (server_feature_v2("promisor-remote", &promisor_remote_config))
- promisor_remote_reply(promisor_remote_config, NULL);
-+ promisor_remote_reply(promisor_remote_config, &accepted);
++ add_server_options(&capabilities, args->server_options);
++ add_promisor_remote_reply(&capabilities);
if (args->filter_options.choice == LOFC_AUTO) {
struct strbuf errbuf = STRBUF_INIT;
@@ fetch-pack.c: static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
seen_ack,
- &negotiation_include_oids)) {
+ &negotiation_include_oids,
-+ accepted)) {
++ &capabilities)) {
trace2_region_leave_printf("negotiation_v2", "round",
the_repository, "%d",
negotiation_round);
@@ fetch-pack.c: static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
- if (negotiator)
- negotiator->release(negotiator);
-+ free(accepted);
- fsck_options_clear(&fsck_options);
- oidset_clear(&common);
- oidset_clear(&negotiation_include_oids);
+ string_list_clear(&packfile_uris, 0);
+ strvec_clear(&index_pack_args);
++ strvec_clear(&capabilities);
+
+ if (fsck_finish(&fsck_options))
+ die("fsck failed");
## t/meson.build ##
@@ t/meson.build: integration_tests = [
3: 4103b0f449 ! 8: 40f7866ade doc: gitprotocol-v2: send the promisor-remote reply with fetch
@@ Commit message
Until a previous commit, a client sent its `promisor-remote=...` reply
only with the `ls-refs` and `bundle-uri` protocol commands.
- Let's clearly document that the client should send that reply with the
- `fetch` command request too.
+ Let's clearly document that the client should send that reply with each
+ `fetch` command request asking for a pack too, as protocol v2 is
+ stateless.
+
+ The `fetch` requests sent only for negotiation, like with `git fetch
+ --negotiate-only`, don't ask for a pack, so they don't need that reply.
Reported-by: Matt Cote <mcote@nvidia.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
@@ Documentation/gitprotocol-v2.adoc: In this case, or if the client doesn't want t
"promisor-remote" capability at all in its reply.
+As protocol v2 is stateless (see the "Capabilities" section above),
-+the client should send this reply with the `fetch` command request,
-+even if it has already sent it with an earlier command request, like
-+`ls-refs`. Note that when only some object IDs are fetched, the client
-+might not send any `ls-refs` command request at all.
++the client should send this reply with each `fetch` command request
++asking for a pack, even if it has already sent it with an earlier
++command request, like `ls-refs` or `bundle-uri`. Note that when only
++some object IDs are fetched, the client might not send any `ls-refs`
++command request at all.
+
On the server side, the "promisor.advertise" and "promisor.sendFields"
configuration options can be used to control what it advertises. On
Christian Couder (8):
connect: pass capability lines to write_command_and_capabilities()
connect: send session-id with ls-refs and bundle-uri
connect: pass a reader to write_command_and_capabilities()
connect: buffer the ls-refs and bundle-uri requests
connect: use write_command_and_capabilities() in get_remote_refs()
connect: use write_command_and_capabilities() in
get_remote_bundle_uri()
fetch-pack: ensure fetch sends a promisor-remote reply
doc: gitprotocol-v2: send the promisor-remote reply with fetch
Documentation/gitprotocol-v2.adoc | 7 ++
connect.c | 128 ++++++++++++---------
connect.h | 30 ++++-
fetch-object-info.c | 7 +-
fetch-pack.c | 23 ++--
t/meson.build | 1 +
t/t5705-session-id-in-capabilities.sh | 26 +++++
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 ++++++++++++++++++++
9 files changed, 322 insertions(+), 66 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
base-commit: e1ec09b23c8e0deb21a0b95ac5996422277395d4
--
2.56.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 1/8] connect: pass capability lines to write_command_and_capabilities()
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 2/8] connect: send session-id with ls-refs and bundle-uri Christian Couder
` (6 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
There are three different functions that write capabilities on the
client side:
- get_remote_refs(),
- send_capabilities(), and
- write_command_and_capabilities().
They duplicate code and make things difficult to understand, fix and
extend.
To start rationalizing this, let's make the
write_command_and_capabilities() function more generic, by replacing
its `const struct string_list *server_options` argument with a
`const struct strvec *capabilities` argument.
This will make it possible for other functions to reuse this function
in following commits.
To allow callers to generate the "server-option=..." capability lines
that can then be passed to write_command_and_capabilities() through its
new `capabilities` argument, let's also add a new add_server_options()
helper function.
No change in behavior is intended.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 32 ++++++++++++++++++++++++++------
connect.h | 17 +++++++++++++++--
fetch-object-info.c | 6 +++++-
fetch-pack.c | 11 +++++++++--
4 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/connect.c b/connect.c
index 87d2e8bccd..5f73fd9e7e 100644
--- a/connect.c
+++ b/connect.c
@@ -723,9 +723,22 @@ int server_supports(const char *feature)
return !!server_feature_value(feature, NULL);
}
+void add_server_options(struct strvec *capabilities,
+ const struct string_list *server_options)
+{
+ struct string_list_item *item;
+
+ if (!server_options)
+ return;
+
+ for_each_string_list_item(item, server_options)
+ strvec_pushf(capabilities, "server-option=%s", item->string);
+}
+
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct string_list *server_options)
+ const struct strvec *capabilities)
{
+ struct strbuf key = STRBUF_INIT;
const char *hash_name;
int advertise_sid = 0;
@@ -737,11 +750,16 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
if (advertise_sid && server_supports_v2("session-id"))
packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
- if (server_options && server_options->nr) {
- ensure_server_supports_v2("server-option");
- for (size_t i = 0; i < server_options->nr; i++)
- packet_buf_write(req_buf, "server-option=%s",
- server_options->items[i].string);
+
+ for (size_t i = 0; i < capabilities->nr; i++) {
+ const char *cap = capabilities->v[i];
+ size_t key_len = strcspn(cap, "=");
+
+ strbuf_add(&key, cap, key_len);
+ ensure_server_supports_v2(key.buf);
+ packet_buf_write(req_buf, "%s", cap);
+
+ strbuf_reset(&key);
}
if (server_feature_v2("object-format", &hash_name)) {
@@ -754,7 +772,9 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
die(_("the server does not support algorithm '%s'"),
the_hash_algo->name);
}
+
packet_buf_delim(req_buf);
+ strbuf_release(&key);
}
static const char *url_scheme_name(enum url_scheme scheme)
diff --git a/connect.h b/connect.h
index 957e5fe2b9..2d5f9e2b83 100644
--- a/connect.h
+++ b/connect.h
@@ -35,11 +35,24 @@ void check_stateless_delimiter(int stateless_rpc,
const char *error);
struct string_list;
+struct strvec;
+
+/*
+ * Append a "server-option=<value>" capability to `capabilities` for
+ * each item in `server_options`, which may be NULL.
+ */
+void add_server_options(struct strvec *capabilities,
+ const struct string_list *server_options);
+
/*
* Write a protocol v2 command request, along with the capability
- * advertisements, into req_buf.
+ * advertisements, into req_buf. The "agent", "session-id" and
+ * "object-format" capabilities are handled here, and must not be in
+ * `capabilities`. `capabilities` contains complete "key[=value]"
+ * lines and must not be NULL. The keys in `capabilities` must have
+ * been advertised by the server, otherwise we die().
*/
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct string_list *server_options);
+ const struct strvec *capabilities);
#endif
diff --git a/fetch-object-info.c b/fetch-object-info.c
index 0a58308f9b..cd14105836 100644
--- a/fetch-object-info.c
+++ b/fetch-object-info.c
@@ -8,6 +8,7 @@
#include "odb.h"
#include "fetch-object-info.h"
#include "string-list.h"
+#include "strvec.h"
/* Sends object-info command and its arguments into the request buffer. */
static void send_object_info_request(const int fd_out,
@@ -17,8 +18,10 @@ static void send_object_info_request(const int fd_out,
unsigned ask_type)
{
struct strbuf req_buf = STRBUF_INIT;
+ struct strvec capabilities = STRVEC_INIT;
- write_command_and_capabilities(&req_buf, "object-info", server_options);
+ add_server_options(&capabilities, server_options);
+ write_command_and_capabilities(&req_buf, "object-info", &capabilities);
if (ask_size)
packet_buf_write(&req_buf, "size");
@@ -35,6 +38,7 @@ static void send_object_info_request(const int fd_out,
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
+ strvec_clear(&capabilities);
strbuf_release(&req_buf);
}
diff --git a/fetch-pack.c b/fetch-pack.c
index 55d311c0c3..ecb384211c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1385,8 +1385,10 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
int haves_added;
int done_sent = 0;
struct strbuf req_buf = STRBUF_INIT;
+ struct strvec capabilities = STRVEC_INIT;
- write_command_and_capabilities(&req_buf, "fetch", args->server_options);
+ add_server_options(&capabilities, args->server_options);
+ write_command_and_capabilities(&req_buf, "fetch", &capabilities);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
@@ -1451,6 +1453,7 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
+ strvec_clear(&capabilities);
strbuf_release(&req_buf);
return done_sent;
}
@@ -2242,6 +2245,7 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
int last_iteration = 0;
int negotiation_round = 0;
timestamp_t min_generation = GENERATION_NUMBER_INFINITY;
+ struct strvec capabilities = STRVEC_INIT;
fetch_negotiator_init(the_repository, &negotiator);
mark_tips(&negotiator, negotiation_restrict_tips);
@@ -2257,6 +2261,8 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
add_to_object_array,
&nt_object_array);
+ add_server_options(&capabilities, server_options);
+
trace2_region_enter("fetch-pack", "negotiate_using_fetch", the_repository);
while (!last_iteration) {
int haves_added;
@@ -2269,7 +2275,7 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
the_repository, "%d",
negotiation_round);
strbuf_reset(&req_buf);
- write_command_and_capabilities(&req_buf, "fetch", server_options);
+ write_command_and_capabilities(&req_buf, "fetch", &capabilities);
packet_buf_write(&req_buf, "wait-for-done");
@@ -2324,6 +2330,7 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
trace2_data_intmax("negotiate_using_fetch", the_repository,
"total_rounds", negotiation_round);
+ strvec_clear(&capabilities);
clear_common_flag(acked_commits);
object_array_clear(&nt_object_array);
oidset_clear(&negotiation_include_oids);
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 2/8] connect: send session-id with ls-refs and bundle-uri
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-20 16:48 ` [PATCH v2 1/8] connect: pass capability lines to write_command_and_capabilities() Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 3/8] connect: pass a reader to write_command_and_capabilities() Christian Couder
` (5 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
1e905bbc00 (fetch-pack: advertise session ID in capabilities,
2020-11-11) only added session-id to fetch-pack and doesn't say why it
was left out elsewhere. According to our "gitprotocol-v2.adoc"
documentation, the goal of session IDs is to identify the process
across multiple requests, so there is no reason to not send it with
every request.
Let's then also send session-id in the `ls-refs` and `bundle-uri`
requests which go through send_capabilities().
Note that this only changes behavior when `transfer.advertiseSID` is
set, which is not the default.
Also note that over file:// and ssh:// one upload-pack process handles
both `ls-refs` and `fetch`, so the server now logs the client's
session-id twice per process, but this is harmless.
Let's add tests in t5705 to check that the server receives the
client's session-id when only `ls-refs` is sent (with `git ls-remote`)
and when only `bundle-uri` is sent (with `test-tool bundle-uri
ls-remote`), as the existing tests there only use `fetch`, which
already sent it.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 6 ++++++
t/t5705-session-id-in-capabilities.sh | 26 ++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/connect.c b/connect.c
index 5f73fd9e7e..40cd279290 100644
--- a/connect.c
+++ b/connect.c
@@ -505,10 +505,16 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
{
const char *hash_name;
const char *promisor_remote_info;
+ int advertise_sid = 0;
+
+ repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
if (server_supports_v2("agent"))
packet_write_fmt(fd_out, "agent=%s", git_user_agent_sanitized());
+ if (advertise_sid && server_supports_v2("session-id"))
+ packet_write_fmt(fd_out, "session-id=%s", trace2_session_id());
+
if (server_feature_v2("object-format", &hash_name)) {
int hash_algo = hash_algo_by_name(hash_name);
if (hash_algo == GIT_HASH_UNKNOWN)
diff --git a/t/t5705-session-id-in-capabilities.sh b/t/t5705-session-id-in-capabilities.sh
index ef0db57d1f..9b35c62629 100755
--- a/t/t5705-session-id-in-capabilities.sh
+++ b/t/t5705-session-id-in-capabilities.sh
@@ -84,4 +84,30 @@ do
'
done
+test_expect_success 'session IDs advertised (ls-remote v2)' '
+ test_when_finished "rm -rf local tr2-server-events" &&
+ cp -r "$LOCAL_PRISTINE" local &&
+ git -c protocol.version=2 -C local ls-remote \
+ --upload-pack "GIT_TRACE2_EVENT=\"$(pwd)/tr2-server-events\" git-upload-pack" \
+ origin &&
+ test_grep \"key\":\"client-sid\" tr2-server-events
+'
+
+test_expect_success 'session IDs advertised (bundle-uri v2)' '
+ test_when_finished "rm -f trace tr2-events" &&
+ test_config -C "$REPO" uploadpack.advertiseBundleURIs true &&
+ test_config_global transfer.advertiseSID true &&
+ test_config_global transfer.bundleURI true &&
+
+ # Only the server logs "client-sid", so the client and the
+ # server can share the same trace2 event file.
+ GIT_TRACE_PACKET="$(pwd)/trace" GIT_TRACE2_EVENT="$(pwd)/tr2-events" \
+ test-tool bundle-uri ls-remote "file://$REPO" &&
+
+ # Only the "bundle-uri" command is sent
+ test_grep "> command=bundle-uri" trace &&
+ test_grep ! "> command=ls-refs" trace &&
+ test_grep \"key\":\"client-sid\" tr2-events
+'
+
test_done
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 3/8] connect: pass a reader to write_command_and_capabilities()
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-20 16:48 ` [PATCH v2 1/8] connect: pass capability lines to write_command_and_capabilities() Christian Couder
2026-11-20 16:48 ` [PATCH v2 2/8] connect: send session-id with ls-refs and bundle-uri Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 4/8] connect: buffer the ls-refs and bundle-uri requests Christian Couder
` (4 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
send_capabilities(), used for `ls-refs` and `bundle-uri`, sets
`reader->hash_algo` to the object format advertised by the server, as
the client may not know its own yet (for example in `git clone`). On
the other hand, write_command_and_capabilities(), used for `fetch` and
`object-info`, checks the server's object format against
`the_hash_algo`.
To enable write_command_and_capabilities() to replace
send_capabilities() in a following commit, let's add a
`struct packet_reader *reader` argument to it.
When that `reader` is NULL, write_command_and_capabilities() behaves as
it used to, but when it is not NULL, it behaves as send_capabilities()
does, and sets `reader->hash_algo` to the server's algorithm.
No behavior change is intended in this patch as callers always pass a
NULL `reader` to write_command_and_capabilities().
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 16 +++++++++++++---
connect.h | 9 +++++++--
fetch-object-info.c | 3 ++-
fetch-pack.c | 6 ++++--
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/connect.c b/connect.c
index 40cd279290..71d9e98a4b 100644
--- a/connect.c
+++ b/connect.c
@@ -742,7 +742,8 @@ void add_server_options(struct strvec *capabilities,
}
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct strvec *capabilities)
+ const struct strvec *capabilities,
+ struct packet_reader *reader)
{
struct strbuf key = STRBUF_INIT;
const char *hash_name;
@@ -770,10 +771,19 @@ void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
if (server_feature_v2("object-format", &hash_name)) {
const unsigned int hash_algo = hash_algo_by_name(hash_name);
- if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
+ if (reader) {
+ if (hash_algo == GIT_HASH_UNKNOWN)
+ die(_("unknown object format '%s' specified by server"),
+ hash_name);
+ reader->hash_algo = &hash_algos[hash_algo];
+ } else if (hash_algo_by_ptr(the_hash_algo) != hash_algo) {
die(_("mismatched algorithms: client %s; server %s"),
the_hash_algo->name, hash_name);
- packet_buf_write(req_buf, "object-format=%s", the_hash_algo->name);
+ }
+ packet_buf_write(req_buf, "object-format=%s",
+ hash_algos[hash_algo].name);
+ } else if (reader) {
+ reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY];
} else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1_LEGACY) {
die(_("the server does not support algorithm '%s'"),
the_hash_algo->name);
diff --git a/connect.h b/connect.h
index 2d5f9e2b83..cff987ae38 100644
--- a/connect.h
+++ b/connect.h
@@ -50,9 +50,14 @@ void add_server_options(struct strvec *capabilities,
* "object-format" capabilities are handled here, and must not be in
* `capabilities`. `capabilities` contains complete "key[=value]"
* lines and must not be NULL. The keys in `capabilities` must have
- * been advertised by the server, otherwise we die().
+ * been advertised by the server, otherwise we die(). If `reader` is
+ * not NULL, its `hash_algo` member is set from the "object-format"
+ * capability sent by the server (or to SHA-1 if the server didn't
+ * send one). Otherwise that capability is checked against
+ * `the_hash_algo`, and we die() if they don't match.
*/
void write_command_and_capabilities(struct strbuf *req_buf, const char *command,
- const struct strvec *capabilities);
+ const struct strvec *capabilities,
+ struct packet_reader *reader);
#endif
diff --git a/fetch-object-info.c b/fetch-object-info.c
index cd14105836..b7a5996233 100644
--- a/fetch-object-info.c
+++ b/fetch-object-info.c
@@ -21,7 +21,8 @@ static void send_object_info_request(const int fd_out,
struct strvec capabilities = STRVEC_INIT;
add_server_options(&capabilities, server_options);
- write_command_and_capabilities(&req_buf, "object-info", &capabilities);
+ write_command_and_capabilities(&req_buf, "object-info",
+ &capabilities, NULL);
if (ask_size)
packet_buf_write(&req_buf, "size");
diff --git a/fetch-pack.c b/fetch-pack.c
index ecb384211c..176d625936 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1388,7 +1388,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
struct strvec capabilities = STRVEC_INIT;
add_server_options(&capabilities, args->server_options);
- write_command_and_capabilities(&req_buf, "fetch", &capabilities);
+ write_command_and_capabilities(&req_buf, "fetch",
+ &capabilities, NULL);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
@@ -2275,7 +2276,8 @@ void negotiate_using_fetch(const struct oid_array *negotiation_restrict_tips,
the_repository, "%d",
negotiation_round);
strbuf_reset(&req_buf);
- write_command_and_capabilities(&req_buf, "fetch", &capabilities);
+ write_command_and_capabilities(&req_buf, "fetch",
+ &capabilities, NULL);
packet_buf_write(&req_buf, "wait-for-done");
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 4/8] connect: buffer the ls-refs and bundle-uri requests
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
` (2 preceding siblings ...)
2026-11-20 16:48 ` [PATCH v2 3/8] connect: pass a reader to write_command_and_capabilities() Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 5/8] connect: use write_command_and_capabilities() in get_remote_refs() Christian Couder
` (3 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
The `fetch` and `object-info` requests are built into a `struct strbuf`
using write_command_and_capabilities() and packet_buf_*() functions,
and then sent with a single write_in_full() call. On the other hand,
the `ls-refs` and `bundle-uri` requests are written directly to the
file descriptor, packet by packet, using packet_write_fmt(),
packet_delim() and packet_flush().
To prepare for using write_command_and_capabilities() in
get_remote_refs() and get_remote_bundle_uri() in following commits,
let's build the `ls-refs` and `bundle-uri` requests into a
`struct strbuf` too, and send each of them with a single
write_in_full().
As send_capabilities() is used for both of these requests, let's make
it write into a `struct strbuf` instead of a file descriptor too.
As packet_buf_write() and packet_write_fmt() format packets in the
same way, the bytes sent on the wire are unchanged. If writing the
request fails though, we now die with "unable to write request to
remote", like for the `fetch` and `object-info` requests, instead of
with "packet write with format failed", or silently from SIGPIPE on
EPIPE.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/connect.c b/connect.c
index 71d9e98a4b..1d923978ba 100644
--- a/connect.c
+++ b/connect.c
@@ -501,7 +501,8 @@ void check_stateless_delimiter(int stateless_rpc,
die("%s", error);
}
-static void send_capabilities(int fd_out, struct packet_reader *reader)
+static void send_capabilities(struct strbuf *req_buf,
+ struct packet_reader *reader)
{
const char *hash_name;
const char *promisor_remote_info;
@@ -510,17 +511,17 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
if (server_supports_v2("agent"))
- packet_write_fmt(fd_out, "agent=%s", git_user_agent_sanitized());
+ packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
if (advertise_sid && server_supports_v2("session-id"))
- packet_write_fmt(fd_out, "session-id=%s", trace2_session_id());
+ packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
if (server_feature_v2("object-format", &hash_name)) {
int hash_algo = hash_algo_by_name(hash_name);
if (hash_algo == GIT_HASH_UNKNOWN)
die(_("unknown object format '%s' specified by server"), hash_name);
reader->hash_algo = &hash_algos[hash_algo];
- packet_write_fmt(fd_out, "object-format=%s", reader->hash_algo->name);
+ packet_buf_write(req_buf, "object-format=%s", reader->hash_algo->name);
} else {
reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY];
}
@@ -528,7 +529,7 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
char *reply;
promisor_remote_reply(promisor_remote_info, &reply);
if (reply) {
- packet_write_fmt(fd_out, "promisor-remote=%s", reply);
+ packet_buf_write(req_buf, "promisor-remote=%s", reply);
free(reply);
}
}
@@ -537,19 +538,24 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
int get_remote_bundle_uri(int fd_out, struct packet_reader *reader,
struct bundle_list *bundles, int stateless_rpc)
{
+ struct strbuf req_buf = STRBUF_INIT;
int line_nr = 1, err = 0;
/* Assert bundle-uri support */
ensure_server_supports_v2("bundle-uri");
/* (Re-)send capabilities */
- send_capabilities(fd_out, reader);
+ send_capabilities(&req_buf, reader);
/* Send command */
- packet_write_fmt(fd_out, "command=bundle-uri\n");
- packet_delim(fd_out);
+ packet_buf_write(&req_buf, "command=bundle-uri\n");
+ packet_buf_delim(&req_buf);
- packet_flush(fd_out);
+ packet_buf_flush(&req_buf);
+
+ if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
+ die_errno(_("unable to write request to remote"));
+ strbuf_release(&req_buf);
/* Process response from server */
while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
@@ -593,6 +599,7 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
int stateless_rpc)
{
size_t i;
+ struct strbuf req_buf = STRBUF_INIT;
struct strvec *ref_prefixes = transport_options ?
&transport_options->ref_prefixes : NULL;
const char **unborn_head_target = transport_options ?
@@ -600,30 +607,34 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
*list = NULL;
ensure_server_supports_v2("ls-refs");
- packet_write_fmt(fd_out, "command=ls-refs\n");
+ packet_buf_write(&req_buf, "command=ls-refs\n");
/* Send capabilities */
- send_capabilities(fd_out, reader);
+ send_capabilities(&req_buf, reader);
if (server_options && server_options->nr) {
ensure_server_supports_v2("server-option");
for (i = 0; i < server_options->nr; i++)
- packet_write_fmt(fd_out, "server-option=%s",
+ packet_buf_write(&req_buf, "server-option=%s",
server_options->items[i].string);
}
- packet_delim(fd_out);
+ packet_buf_delim(&req_buf);
/* When pushing we don't want to request the peeled tags */
if (!for_push)
- packet_write_fmt(fd_out, "peel\n");
- packet_write_fmt(fd_out, "symrefs\n");
+ packet_buf_write(&req_buf, "peel\n");
+ packet_buf_write(&req_buf, "symrefs\n");
if (server_supports_feature("ls-refs", "unborn", 0))
- packet_write_fmt(fd_out, "unborn\n");
+ packet_buf_write(&req_buf, "unborn\n");
for (i = 0; ref_prefixes && i < ref_prefixes->nr; i++) {
- packet_write_fmt(fd_out, "ref-prefix %s\n",
+ packet_buf_write(&req_buf, "ref-prefix %s\n",
ref_prefixes->v[i]);
}
- packet_flush(fd_out);
+ packet_buf_flush(&req_buf);
+
+ if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
+ die_errno(_("unable to write request to remote"));
+ strbuf_release(&req_buf);
/* Process response from server */
while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 5/8] connect: use write_command_and_capabilities() in get_remote_refs()
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
` (3 preceding siblings ...)
2026-11-20 16:48 ` [PATCH v2 4/8] connect: buffer the ls-refs and bundle-uri requests Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 6/8] connect: use write_command_and_capabilities() in get_remote_bundle_uri() Christian Couder
` (2 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
As previous commits made write_command_and_capabilities() more generic,
we can now use that function in get_remote_refs() instead of
send_capabilities() and the open-coded "server-option" loop. Let's do
that then, which prepares for removing send_capabilities() in a
following commit.
Let's also refactor writing the "promisor-remote" reply into a new
add_promisor_remote_reply() helper function. This duplicates code which
is in send_capabilities() but we are going to remove that function in a
following commit. Let's declare this new helper in "connect.h" as it
will also be used in "fetch-pack.c" in a following commit.
Note that the order of the `ls-refs` request lines changes. After
"command, agent, [session-id]"
it used to be:
"object-format, promisor-remote, server-option*"
but now it is:
"server-option*, promisor-remote, object-format".
This should not affect the server's behavior as "serve.c" and JGit both
accept capabilities in any order after "command=...".
Also note that "command=ls-refs" no longer ends with "\n", which is
harmless because the server chomps newlines.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 34 +++++++++++++++++++++-------------
connect.h | 8 ++++++++
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/connect.c b/connect.c
index 1d923978ba..9d5585f72b 100644
--- a/connect.c
+++ b/connect.c
@@ -501,6 +501,21 @@ void check_stateless_delimiter(int stateless_rpc,
die("%s", error);
}
+void add_promisor_remote_reply(struct strvec *capabilities)
+{
+ const char *promisor_remote_info;
+ char *reply;
+
+ if (!server_feature_v2("promisor-remote", &promisor_remote_info))
+ return;
+
+ promisor_remote_reply(promisor_remote_info, &reply);
+ if (reply) {
+ strvec_pushf(capabilities, "promisor-remote=%s", reply);
+ free(reply);
+ }
+}
+
static void send_capabilities(struct strbuf *req_buf,
struct packet_reader *reader)
{
@@ -600,26 +615,18 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
{
size_t i;
struct strbuf req_buf = STRBUF_INIT;
+ struct strvec capabilities = STRVEC_INIT;
struct strvec *ref_prefixes = transport_options ?
&transport_options->ref_prefixes : NULL;
const char **unborn_head_target = transport_options ?
&transport_options->unborn_head_target : NULL;
*list = NULL;
- ensure_server_supports_v2("ls-refs");
- packet_buf_write(&req_buf, "command=ls-refs\n");
-
- /* Send capabilities */
- send_capabilities(&req_buf, reader);
-
- if (server_options && server_options->nr) {
- ensure_server_supports_v2("server-option");
- for (i = 0; i < server_options->nr; i++)
- packet_buf_write(&req_buf, "server-option=%s",
- server_options->items[i].string);
- }
+ add_server_options(&capabilities, server_options);
+ add_promisor_remote_reply(&capabilities);
+ write_command_and_capabilities(&req_buf, "ls-refs",
+ &capabilities, reader);
- packet_buf_delim(&req_buf);
/* When pushing we don't want to request the peeled tags */
if (!for_push)
packet_buf_write(&req_buf, "peel\n");
@@ -634,6 +641,7 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
+ strvec_clear(&capabilities);
strbuf_release(&req_buf);
/* Process response from server */
diff --git a/connect.h b/connect.h
index cff987ae38..00afc8c95a 100644
--- a/connect.h
+++ b/connect.h
@@ -44,6 +44,14 @@ struct strvec;
void add_server_options(struct strvec *capabilities,
const struct string_list *server_options);
+/*
+ * If the server advertised the "promisor-remote" capability, compute
+ * our reply, which also marks the accepted promisor remotes, and
+ * append "promisor-remote=<reply>" to `capabilities` if any remote
+ * was accepted.
+ */
+void add_promisor_remote_reply(struct strvec *capabilities);
+
/*
* Write a protocol v2 command request, along with the capability
* advertisements, into req_buf. The "agent", "session-id" and
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 6/8] connect: use write_command_and_capabilities() in get_remote_bundle_uri()
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
` (4 preceding siblings ...)
2026-11-20 16:48 ` [PATCH v2 5/8] connect: use write_command_and_capabilities() in get_remote_refs() Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 7/8] fetch-pack: ensure fetch sends a promisor-remote reply Christian Couder
2026-11-20 16:48 ` [PATCH v2 8/8] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
Now that previous commits made write_command_and_capabilities() more
generic, we can use that function in get_remote_bundle_uri() instead of
send_capabilities().
Let's do that then, and let's remove send_capabilities() while at it,
as it no longer has any caller.
As before, no "server-option" capability is sent with the `bundle-uri`
request.
Note that now "command=bundle-uri" comes first on the wire instead of
last, and "promisor-remote" now comes before "object-format", but this
should not be an issue as "serve.c" accepts capabilities and
"command=..." in any order, and JGit doesn't implement "bundle-uri".
Also note that "command=bundle-uri" no longer ends with "\n", which is
harmless because the server chomps newlines.
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
connect.c | 49 +++++--------------------------------------------
1 file changed, 5 insertions(+), 44 deletions(-)
diff --git a/connect.c b/connect.c
index 9d5585f72b..3d0afb2d27 100644
--- a/connect.c
+++ b/connect.c
@@ -516,60 +516,21 @@ void add_promisor_remote_reply(struct strvec *capabilities)
}
}
-static void send_capabilities(struct strbuf *req_buf,
- struct packet_reader *reader)
-{
- const char *hash_name;
- const char *promisor_remote_info;
- int advertise_sid = 0;
-
- repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid);
-
- if (server_supports_v2("agent"))
- packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
-
- if (advertise_sid && server_supports_v2("session-id"))
- packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
-
- if (server_feature_v2("object-format", &hash_name)) {
- int hash_algo = hash_algo_by_name(hash_name);
- if (hash_algo == GIT_HASH_UNKNOWN)
- die(_("unknown object format '%s' specified by server"), hash_name);
- reader->hash_algo = &hash_algos[hash_algo];
- packet_buf_write(req_buf, "object-format=%s", reader->hash_algo->name);
- } else {
- reader->hash_algo = &hash_algos[GIT_HASH_SHA1_LEGACY];
- }
- if (server_feature_v2("promisor-remote", &promisor_remote_info)) {
- char *reply;
- promisor_remote_reply(promisor_remote_info, &reply);
- if (reply) {
- packet_buf_write(req_buf, "promisor-remote=%s", reply);
- free(reply);
- }
- }
-}
-
int get_remote_bundle_uri(int fd_out, struct packet_reader *reader,
struct bundle_list *bundles, int stateless_rpc)
{
struct strbuf req_buf = STRBUF_INIT;
+ struct strvec capabilities = STRVEC_INIT;
int line_nr = 1, err = 0;
- /* Assert bundle-uri support */
- ensure_server_supports_v2("bundle-uri");
-
- /* (Re-)send capabilities */
- send_capabilities(&req_buf, reader);
-
- /* Send command */
- packet_buf_write(&req_buf, "command=bundle-uri\n");
- packet_buf_delim(&req_buf);
-
+ add_promisor_remote_reply(&capabilities);
+ write_command_and_capabilities(&req_buf, "bundle-uri",
+ &capabilities, reader);
packet_buf_flush(&req_buf);
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
+ strvec_clear(&capabilities);
strbuf_release(&req_buf);
/* Process response from server */
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 7/8] fetch-pack: ensure fetch sends a promisor-remote reply
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
` (5 preceding siblings ...)
2026-11-20 16:48 ` [PATCH v2 6/8] connect: use write_command_and_capabilities() in get_remote_bundle_uri() Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
2026-11-20 16:48 ` [PATCH v2 8/8] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
In protocol v2, when the client accepts promisor remotes, the
`promisor-remote=...` reply is only sent with the `ls-refs` and
`bundle-uri` protocol commands, by get_remote_refs() and
get_remote_bundle_uri() in "connect.c".
The request for the `fetch` protocol command is built by
send_fetch_request() in "fetch-pack.c" which doesn't send that reply.
do_fetch_pack_v2() calls promisor_remote_reply(), but only to mark the
accepted remotes, as e15a6b2f8b (promisor-remote: change
promisor_remote_reply()'s signature, 2026-02-16) assumed that
fetch-pack would not need to send a reply.
With file:// and ssh:// URLs on a Git server, one upload-pack process
handles both `ls-refs` and `fetch`. The acceptance recorded during
`ls-refs` by promisor_remote_receive() in "serve.c" is still there at
`fetch` time, so the clone succeeds. But it fails when each request is
handled on its own, for example with HTTP where different upload-pack
processes are used.
It also fails when only object IDs are fetched, as no `ls-refs`
command is then sent. In these cases, the server doesn't know that the
client accepted a promisor remote, so it doesn't allow promisor
objects to be missing from the pack it sends, and it fails with "could
not fetch <oid> from promisor remote".
Let's fix that by building the list of capabilities for the `fetch`
requests once in do_fetch_pack_v2(), using add_server_options() and
add_promisor_remote_reply(), and by passing that list to
send_fetch_request(). This way the `promisor-remote=...` reply is
always properly sent with the `fetch` requests, and the accepted
remotes are still marked at the same point as before.
The `fetch` requests sent by negotiate_using_fetch() don't ask for a
pack, so they don't need that reply.
Let's also add tests in t5710 to check that the reply is sent with the
`fetch` request, and that fetching only an object ID works. For HTTP,
let's add a new t5711 test script, copying the setup from t5710.
Reported-by: Matt Cote <mcote@nvidia.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
fetch-pack.c | 18 +--
t/meson.build | 1 +
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 +++++++++++++++++++++
4 files changed, 176 insertions(+), 9 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
diff --git a/fetch-pack.c b/fetch-pack.c
index 176d625936..3d6d3e33a2 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1380,16 +1380,15 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
const struct ref *wants, struct oidset *common,
int *haves_to_send, int *in_vain,
int sideband_all, int seen_ack,
- struct oidset *negotiation_include_oids)
+ struct oidset *negotiation_include_oids,
+ const struct strvec *capabilities)
{
int haves_added;
int done_sent = 0;
struct strbuf req_buf = STRBUF_INIT;
- struct strvec capabilities = STRVEC_INIT;
- add_server_options(&capabilities, args->server_options);
write_command_and_capabilities(&req_buf, "fetch",
- &capabilities, NULL);
+ capabilities, NULL);
if (args->use_thin_pack)
packet_buf_write(&req_buf, "thin-pack");
@@ -1454,7 +1453,6 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
die_errno(_("unable to write request to remote"));
- strvec_clear(&capabilities);
strbuf_release(&req_buf);
return done_sent;
}
@@ -1698,12 +1696,12 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
struct string_list packfile_uris = STRING_LIST_INIT_DUP;
int i;
struct strvec index_pack_args = STRVEC_INIT;
- const char *promisor_remote_config;
+ struct strvec capabilities = STRVEC_INIT;
fsck_options_init(&fsck_options, the_repository, FSCK_OPTIONS_MISSING_GITMODULES);
- if (server_feature_v2("promisor-remote", &promisor_remote_config))
- promisor_remote_reply(promisor_remote_config, NULL);
+ add_server_options(&capabilities, args->server_options);
+ add_promisor_remote_reply(&capabilities);
if (args->filter_options.choice == LOFC_AUTO) {
struct strbuf errbuf = STRBUF_INIT;
@@ -1781,7 +1779,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
&haves_to_send, &in_vain,
reader.use_sideband,
seen_ack,
- &negotiation_include_oids)) {
+ &negotiation_include_oids,
+ &capabilities)) {
trace2_region_leave_printf("negotiation_v2", "round",
the_repository, "%d",
negotiation_round);
@@ -1924,6 +1923,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
string_list_clear(&packfile_uris, 0);
strvec_clear(&index_pack_args);
+ strvec_clear(&capabilities);
if (fsck_finish(&fsck_options))
die("fsck failed");
diff --git a/t/meson.build b/t/meson.build
index 1cf1d95f70..84644703f1 100644
--- a/t/meson.build
+++ b/t/meson.build
@@ -766,6 +766,7 @@ integration_tests = [
't5704-protocol-violations.sh',
't5705-session-id-in-capabilities.sh',
't5710-promisor-remote-capability.sh',
+ 't5711-promisor-remote-capability-http.sh',
't5730-protocol-v2-bundle-uri-file.sh',
't5731-protocol-v2-bundle-uri-git.sh',
't5732-protocol-v2-bundle-uri-http.sh',
diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh
index 463e9e00b0..e5d6f9d1c6 100755
--- a/t/t5710-promisor-remote-capability.sh
+++ b/t/t5710-promisor-remote-capability.sh
@@ -999,6 +999,46 @@ test_expect_success "clone and fetch with --filter=auto" '
check_missing_objects server 1 "$oid"
'
+test_expect_success "clone sends the promisor-remote reply with fetch" '
+ git -C server config promisor.advertise true &&
+ test_when_finished "rm -rf client trace" &&
+
+ GIT_TRACE_PACKET="$(pwd)/trace" git clone \
+ -c remote.lop.promisor=true \
+ -c remote.lop.url="$TRASH_DIRECTORY_URL/lop" \
+ -c promisor.acceptfromserver=All \
+ --no-local --filter="blob:limit=5k" server client &&
+
+ # Check that the reply is part of the fetch request
+ sed -n "/clone> command=fetch/,/clone> 0001/p" trace >request &&
+ test_grep "clone> promisor-remote=lop" request &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects server 1 "$oid"
+'
+
+test_expect_success "fetch by object ID sends the promisor-remote reply" '
+ git -C server config promisor.advertise true &&
+ test_when_finished "rm -rf client trace" &&
+
+ git init client &&
+ git -C client remote add origin "$TRASH_DIRECTORY_URL/server" &&
+ git -C client config remote.lop.promisor true &&
+ git -C client config remote.lop.url "$TRASH_DIRECTORY_URL/lop" &&
+ git -C client config promisor.acceptfromserver All &&
+
+ # Fetching only an object ID skips the "ls-refs" command, so the
+ # reply can only be sent with "fetch"
+ head=$(git -C server rev-parse HEAD) &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch --no-tags \
+ --filter="blob:limit=5k" origin "$head" &&
+ test_grep ! "fetch> command=ls-refs" trace &&
+ test_grep "fetch> promisor-remote=lop" trace &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects server 1 "$oid"
+'
+
test_expect_success "clone with promisor.advertise set to 'true' but don't delete the client" '
git -C server config promisor.advertise true &&
diff --git a/t/t5711-promisor-remote-capability-http.sh b/t/t5711-promisor-remote-capability-http.sh
new file mode 100755
index 0000000000..c08cca3e51
--- /dev/null
+++ b/t/t5711-promisor-remote-capability-http.sh
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+test_description='handling of promisor remote advertisement over HTTP'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PERL_TEST_HELPERS
+then
+ skip_all='skipping promisor remote capabilities tests; Perl not available'
+ test_done
+fi
+
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+GIT_TEST_MULTI_PACK_INDEX=0
+GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0
+
+# The setup and helpers below are copied from t5710, except that the
+# server repository is in the HTTP document root.
+
+SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server.git"
+
+check_missing_objects () {
+ git -C "$1" rev-list --objects --all --missing=print > all.txt &&
+ perl -ne 'print if s/^[?]//' all.txt >missing.txt &&
+ test_line_count = "$2" missing.txt &&
+ test "$3" = "$(cat missing.txt)"
+}
+
+initialize_server () {
+ # Repack everything first
+ git -C "$SERVER" -c repack.writebitmaps=false repack -a -d &&
+
+ # Repack without the largest object and create a promisor pack on server
+ git -C "$SERVER" -c repack.writebitmaps=false repack -a -d \
+ --filter=blob:limit=5k --filter-to="$(pwd)/pack" &&
+ promisor_file=$(ls "$SERVER"/objects/pack/*.pack | sed "s/\.pack/.promisor/") &&
+ >"$promisor_file" &&
+
+ # Check objects missing on the server
+ check_missing_objects "$SERVER" 1 "$1"
+}
+
+copy_to_lop () {
+ oid_path="$(test_oid_to_path $1)" &&
+ path="$SERVER/objects/$oid_path" &&
+ path2="lop/objects/$oid_path" &&
+ mkdir -p $(dirname "$path2") &&
+ cp "$path" "$path2"
+}
+
+# On Windows, `pwd` returns a path like 'D:/foo/bar'. Prepend '/' to turn
+# it into '/D:/foo/bar', which is what git expects in file:// URLs on Windows.
+# On Unix, the path already starts with '/', so this is a no-op.
+pwd_path=$(pwd)
+case "$pwd_path" in
+[a-zA-Z]:*) pwd_path="/$pwd_path" ;;
+esac
+
+TRASH_DIRECTORY_URL="file://$pwd_path"
+
+test_expect_success 'setup: create "template" repository' '
+ git init template &&
+ test_commit -C template 1 &&
+ test_commit -C template 2 &&
+ test_commit -C template 3 &&
+ test-tool genrandom foo 10k >template/foo &&
+ git -C template add foo &&
+ git -C template commit -m foo
+'
+
+# A bare repo will act as a server repo with unpacked objects.
+test_expect_success 'setup: create bare "server" repository' '
+ git clone --bare --no-local template "$SERVER" &&
+ mv "$SERVER"/objects/pack/pack-* . &&
+ packfile=$(ls pack-*.pack) &&
+ git -C "$SERVER" unpack-objects --strict <"$packfile"
+'
+
+test_expect_success "setup for testing promisor remote advertisement" '
+ # Create another bare repo called "lop" (for Large Object Promisor)
+ git init --bare lop &&
+
+ # Copy the largest object from server to lop
+ obj="HEAD:foo" &&
+ oid="$(git -C "$SERVER" rev-parse $obj)" &&
+ copy_to_lop "$oid" &&
+
+ initialize_server "$oid" &&
+
+ # Configure lop as promisor remote for server
+ git -C "$SERVER" remote add lop "$TRASH_DIRECTORY_URL/lop" &&
+ git -C "$SERVER" config remote.lop.promisor true &&
+
+ git -C lop config uploadpack.allowFilter true &&
+ git -C lop config uploadpack.allowAnySHA1InWant true &&
+ git -C "$SERVER" config uploadpack.allowFilter true &&
+ git -C "$SERVER" config uploadpack.allowAnySHA1InWant true &&
+ git -C "$SERVER" config promisor.advertise true
+'
+
+# Over HTTP, each request is handled by a separate upload-pack process,
+# so the server knows that the client accepted "lop" only if the reply
+# is sent with the "fetch" request itself.
+test_expect_success "clone over HTTP with an accepted promisor remote" '
+ test_when_finished "rm -rf client trace" &&
+
+ GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 clone \
+ -c remote.lop.promisor=true \
+ -c remote.lop.url="$TRASH_DIRECTORY_URL/lop" \
+ -c promisor.acceptfromserver=All \
+ --filter="blob:limit=5k" "$HTTPD_URL/smart/server.git" client &&
+
+ # Check that the reply is part of the fetch request
+ sed -n "/clone> command=fetch/,/clone> 0001/p" trace >request &&
+ test_grep "clone> promisor-remote=lop" request &&
+
+ # Check that the largest object was lazily fetched from lop
+ test_cmp template/foo client/foo &&
+
+ # Check that the largest object is still missing on the server
+ check_missing_objects "$SERVER" 1 "$oid"
+'
+
+test_done
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 8/8] doc: gitprotocol-v2: send the promisor-remote reply with fetch
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
` (6 preceding siblings ...)
2026-11-20 16:48 ` [PATCH v2 7/8] fetch-pack: ensure fetch sends a promisor-remote reply Christian Couder
@ 2026-11-20 16:48 ` Christian Couder
7 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:48 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Matt Cote, Christian Couder
Until a previous commit, a client sent its `promisor-remote=...` reply
only with the `ls-refs` and `bundle-uri` protocol commands.
Let's clearly document that the client should send that reply with each
`fetch` command request asking for a pack too, as protocol v2 is
stateless.
The `fetch` requests sent only for negotiation, like with `git fetch
--negotiate-only`, don't ask for a pack, so they don't need that reply.
Reported-by: Matt Cote <mcote@nvidia.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
Documentation/gitprotocol-v2.adoc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/gitprotocol-v2.adoc b/Documentation/gitprotocol-v2.adoc
index dd52fd8110..d70d7ab19b 100644
--- a/Documentation/gitprotocol-v2.adoc
+++ b/Documentation/gitprotocol-v2.adoc
@@ -879,6 +879,13 @@ In this case, or if the client doesn't want to use any promisor remote
the server advertised, the client shouldn't advertise the
"promisor-remote" capability at all in its reply.
+As protocol v2 is stateless (see the "Capabilities" section above),
+the client should send this reply with each `fetch` command request
+asking for a pack, even if it has already sent it with an earlier
+command request, like `ls-refs` or `bundle-uri`. Note that when only
+some object IDs are fetched, the client might not send any `ls-refs`
+command request at all.
+
On the server side, the "promisor.advertise" and "promisor.sendFields"
configuration options can be used to control what it advertises. On
the client side, the "promisor.acceptFromServer" and
--
2.56.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply
2026-11-13 19:11 ` Junio C Hamano
@ 2026-11-20 16:57 ` Christian Couder
0 siblings, 0 replies; 18+ messages in thread
From: Christian Couder @ 2026-11-20 16:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Patrick Steinhardt, Matt Cote
On Fri, Nov 13, 2026 at 8:11 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Christian Couder <christian.couder@gmail.com> writes:
>
> > They duplicate code for sending "server-option", "agent" and
> > "object-format", while each sends a different set of capabilities.
>
> That is all the more reason to clean them up before we pile more
> stuff on top, no?
>
> I do not know if that deserves to be called "significant"
> refactoring, though. It would not take a series with 20 patches
> each of which weigh more than 30 lines touched, no?
As you can see in the v2 I just sent, it took 6 refactoring patches
instead of 1.
The diffstat is now:
Documentation/gitprotocol-v2.adoc | 7 ++
connect.c | 128 ++++++++++++---------
connect.h | 30 ++++-
fetch-object-info.c | 7 +-
fetch-pack.c | 23 ++--
t/meson.build | 1 +
t/t5705-session-id-in-capabilities.sh | 26 +++++
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 ++++++++++++++++++++
9 files changed, 322 insertions(+), 66 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
instead of:
Documentation/gitprotocol-v2.adoc | 6 +
connect.c | 6 +-
connect.h | 6 +-
fetch-object-info.c | 3 +-
fetch-pack.c | 17 ++-
t/meson.build | 1 +
t/t5710-promisor-remote-capability.sh | 40 +++++++
t/t5711-promisor-remote-capability-http.sh | 126 +++++++++++++++++++++
8 files changed, 196 insertions(+), 9 deletions(-)
create mode 100755 t/t5711-promisor-remote-capability-http.sh
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-11-20 16:57 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 19:58 [PATCH 0/3] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-12 19:59 ` [PATCH 1/3] connect: let write_command_and_capabilities() send a promisor-remote reply Christian Couder
2026-11-12 22:18 ` Junio C Hamano
2026-11-12 22:34 ` Junio C Hamano
2026-11-13 13:10 ` Christian Couder
2026-11-13 19:11 ` Junio C Hamano
2026-11-20 16:57 ` Christian Couder
2026-11-12 19:59 ` [PATCH 2/3] fetch-pack: ensure fetch sends " Christian Couder
2026-11-12 19:59 ` [PATCH 3/3] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
2026-11-20 16:48 ` [PATCH v2 0/8] Fix promisor-remote reply missing from fetch Christian Couder
2026-11-20 16:48 ` [PATCH v2 1/8] connect: pass capability lines to write_command_and_capabilities() Christian Couder
2026-11-20 16:48 ` [PATCH v2 2/8] connect: send session-id with ls-refs and bundle-uri Christian Couder
2026-11-20 16:48 ` [PATCH v2 3/8] connect: pass a reader to write_command_and_capabilities() Christian Couder
2026-11-20 16:48 ` [PATCH v2 4/8] connect: buffer the ls-refs and bundle-uri requests Christian Couder
2026-11-20 16:48 ` [PATCH v2 5/8] connect: use write_command_and_capabilities() in get_remote_refs() Christian Couder
2026-11-20 16:48 ` [PATCH v2 6/8] connect: use write_command_and_capabilities() in get_remote_bundle_uri() Christian Couder
2026-11-20 16:48 ` [PATCH v2 7/8] fetch-pack: ensure fetch sends a promisor-remote reply Christian Couder
2026-11-20 16:48 ` [PATCH v2 8/8] doc: gitprotocol-v2: send the promisor-remote reply with fetch Christian Couder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox