| 538 | } |
| 539 | |
| 540 | static 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 | |
| 580 | static int show_head_ref(const struct reference *ref, void *cb_data) |
| 581 | { |
nothing calls this directly
no test coverage detected