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

Function get_info_refs

http-backend.c:540–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
541{
542 const char *service_name = get_parameter("service");
543 struct strbuf buf = STRBUF_INIT;
544
545 hdr_nocache(hdr);
546
547 if (service_name) {
548 const char *argv[] = {NULL /* service name */,
549 "--http-backend-info-refs",
550 ".", NULL};
551 struct rpc_service *svc = select_service(hdr, service_name);
552
553 strbuf_addf(&buf, "application/x-git-%s-advertisement",
554 svc->name);
555 hdr_str(hdr, content_type, buf.buf);
556 end_headers(hdr);
557
558
559 if (determine_protocol_version_server() != protocol_v2) {
560 packet_write_fmt(1, "# service=git-%s\n", svc->name);
561 packet_flush(1);
562 }
563
564 argv[0] = svc->name;
565 run_service(argv, 0);
566
567 } else {
568 struct refs_for_each_ref_options opts = {
569 .namespace = get_git_namespace(),
570 };
571
572 select_getanyfile(hdr);
573 refs_for_each_ref_ext(get_main_ref_store(the_repository),
574 show_text_ref, &buf, &opts);
575 send_strbuf(hdr, "text/plain", &buf);
576 }
577 strbuf_release(&buf);
578}
579
580static int show_head_ref(const struct reference *ref, void *cb_data)
581{

Callers

nothing calls this directly

Calls 15

get_parameterFunction · 0.85
hdr_nocacheFunction · 0.85
select_serviceFunction · 0.85
strbuf_addfFunction · 0.85
hdr_strFunction · 0.85
end_headersFunction · 0.85
packet_write_fmtFunction · 0.85
packet_flushFunction · 0.85
get_git_namespaceFunction · 0.85
select_getanyfileFunction · 0.85
refs_for_each_ref_extFunction · 0.85

Tested by

no test coverage detected