MCPcopy Index your code
hub / github.com/git/git / write_fetch_command_and_capabilities

Function write_fetch_command_and_capabilities

fetch-pack.c:1379–1409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379static void write_fetch_command_and_capabilities(struct strbuf *req_buf,
1380 const struct string_list *server_options)
1381{
1382 const char *hash_name;
1383
1384 ensure_server_supports_v2("fetch");
1385 packet_buf_write(req_buf, "command=fetch");
1386 if (server_supports_v2("agent"))
1387 packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
1388 if (advertise_sid && server_supports_v2("session-id"))
1389 packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
1390 if (server_options && server_options->nr) {
1391 int i;
1392 ensure_server_supports_v2("server-option");
1393 for (i = 0; i < server_options->nr; i++)
1394 packet_buf_write(req_buf, "server-option=%s",
1395 server_options->items[i].string);
1396 }
1397
1398 if (server_feature_v2("object-format", &hash_name)) {
1399 int hash_algo = hash_algo_by_name(hash_name);
1400 if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
1401 die(_("mismatched algorithms: client %s; server %s"),
1402 the_hash_algo->name, hash_name);
1403 packet_buf_write(req_buf, "object-format=%s", the_hash_algo->name);
1404 } else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1_LEGACY) {
1405 die(_("the server does not support algorithm '%s'"),
1406 the_hash_algo->name);
1407 }
1408 packet_buf_delim(req_buf);
1409}
1410
1411static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
1412 struct fetch_pack_args *args,

Callers 2

send_fetch_requestFunction · 0.85
negotiate_using_fetchFunction · 0.85

Calls 10

packet_buf_writeFunction · 0.85
server_supports_v2Function · 0.85
git_user_agent_sanitizedFunction · 0.85
trace2_session_idFunction · 0.85
server_feature_v2Function · 0.85
hash_algo_by_nameFunction · 0.85
hash_algo_by_ptrFunction · 0.85
packet_buf_delimFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected