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

Function write_v0_ref

upload-pack.c:1231–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1229}
1230
1231static void write_v0_ref(struct upload_pack_data *data,
1232 const struct reference *ref,
1233 const char *refname_nons)
1234{
1235 static const char *capabilities = "multi_ack thin-pack side-band"
1236 " side-band-64k ofs-delta shallow deepen-since deepen-not"
1237 " deepen-relative no-progress include-tag multi_ack_detailed";
1238 struct object_id peeled;
1239
1240 if (mark_our_ref(refname_nons, ref->name, ref->oid, &data->hidden_refs))
1241 return;
1242
1243 if (capabilities) {
1244 struct strbuf symref_info = STRBUF_INIT;
1245 struct strbuf session_id = STRBUF_INIT;
1246
1247 format_symref_info(&symref_info, &data->symref);
1248 format_session_id(&session_id, data);
1249 packet_fwrite_fmt(stdout, "%s %s%c%s%s%s%s%s%s%s object-format=%s agent=%s\n",
1250 oid_to_hex(ref->oid), refname_nons,
1251 0, capabilities,
1252 (data->allow_uor & ALLOW_TIP_SHA1) ?
1253 " allow-tip-sha1-in-want" : "",
1254 (data->allow_uor & ALLOW_REACHABLE_SHA1) ?
1255 " allow-reachable-sha1-in-want" : "",
1256 data->no_done ? " no-done" : "",
1257 symref_info.buf,
1258 data->allow_filter ? " filter" : "",
1259 session_id.buf,
1260 the_hash_algo->name,
1261 git_user_agent_sanitized());
1262 strbuf_release(&symref_info);
1263 strbuf_release(&session_id);
1264 data->sent_capabilities = 1;
1265 } else {
1266 packet_fwrite_fmt(stdout, "%s %s\n", oid_to_hex(ref->oid), refname_nons);
1267 }
1268 capabilities = NULL;
1269 if (!reference_get_peeled_oid(the_repository, ref, &peeled))
1270 packet_fwrite_fmt(stdout, "%s %s^{}\n", oid_to_hex(&peeled), refname_nons);
1271 return;
1272}
1273
1274static int send_ref(const struct reference *ref, void *cb_data)
1275{

Callers 2

send_refFunction · 0.85
upload_packFunction · 0.85

Calls 8

mark_our_refFunction · 0.85
format_symref_infoFunction · 0.85
format_session_idFunction · 0.85
packet_fwrite_fmtFunction · 0.85
oid_to_hexFunction · 0.85
git_user_agent_sanitizedFunction · 0.85
strbuf_releaseFunction · 0.85
reference_get_peeled_oidFunction · 0.85

Tested by

no test coverage detected