Thread (380 messages) 380 messages, 13 authors, 2026-07-24

Re: [PATCH v2 1/6] fetch-pack: refactor packet writing

From: Christian Couder <hidden>
Date: 2024-09-24 11:45:45

On Sat, Jul 20, 2024 at 5:43 AM Eric Ju [off-list ref] wrote:
From: Calvin Wan <redacted>

A subsequent patch needs to write capabilities for another command.
Refactor write_fetch_command_and_capabilities() to be a more general
purpose function write_command_and_capabilities(), so that it can be
used by both fetch and future command.

Here "command" means the "operations" supported by Git’s wire protocol
https://git-scm.com/docs/protocol-v2. An example would be a
git's subcommand, such as git-fetch(1); or an operation supported by
the server side such as "object-info" implemented in "a2ba162cda
(object-info: support for retrieving object info, 2021-04-20)".
I agree that reusing or refactoring the new
write_command_and_capabilities() function for more commands can be
done in a separate series that could perhaps also move the new
function to connect.c. Maybe this could be added to the commit message
though.

[...]
quoted hunk ↗ jump to hunk
-static void write_fetch_command_and_capabilities(struct strbuf *req_buf,
-                                                const struct string_list *server_options)
+static void write_command_and_capabilities(struct strbuf *req_buf,
+                                                const struct string_list *server_options, const char* command)
In https://lore.kernel.org/git/xmqqfsn0qsi4.fsf@gitster.g/ (local) Junio
suggested swaping the "command" and "server_options" arguments as well
as sticking the "*" to "command" instead of "char", so:

static void write_command_and_capabilities(struct strbuf *req_buf,

const char *command,

const struct string_list *server_options)

The rest of the patch looks good.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help