Skip to content

Commit 5b204b7

Browse files
jonathantanmygitster
authored andcommitted
fetch-pack: send server options after command
Currently, if any server options are specified during a protocol v2 fetch, server options will be sent before "command=fetch". Write server options to the request buffer in send_fetch_request() so that the components of the request are sent in the correct order. The protocol documentation states that the command must come first. The Git server implementation in serve.c (see process_request() in that file) tolerates any order of command and capability, which is perhaps why we haven't noticed this. This was noticed when testing against a JGit server implementation, which follows the documentation in this regard. Signed-off-by: Jonathan Tan <[email protected]> Acked-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e98305 commit 5b204b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
11111111
server_supports_v2("server-option", 1)) {
11121112
int i;
11131113
for (i = 0; i < args->server_options->nr; i++)
1114-
packet_write_fmt(fd_out, "server-option=%s",
1114+
packet_buf_write(&req_buf, "server-option=%s",
11151115
args->server_options->items[i].string);
11161116
}
11171117

0 commit comments

Comments
 (0)