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

Function parse_want_ref

upload-pack.c:1507–1550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1505}
1506
1507static int parse_want_ref(struct packet_writer *writer, const char *line,
1508 struct strmap *wanted_refs,
1509 struct strvec *hidden_refs,
1510 struct object_array *want_obj)
1511{
1512 const char *refname_nons;
1513 if (skip_prefix(line, "want-ref ", &refname_nons)) {
1514 struct object_id oid;
1515 struct object *o = NULL;
1516 struct strbuf refname = STRBUF_INIT;
1517
1518 strbuf_addf(&refname, "%s%s", get_git_namespace(), refname_nons);
1519 if (ref_is_hidden(refname_nons, refname.buf, hidden_refs) ||
1520 refs_read_ref(get_main_ref_store(the_repository), refname.buf, &oid)) {
1521 packet_writer_error(writer, "unknown ref %s", refname_nons);
1522 die("unknown ref %s", refname_nons);
1523 }
1524 strbuf_release(&refname);
1525
1526 if (strmap_put(wanted_refs, refname_nons, oiddup(&oid))) {
1527 packet_writer_error(writer, "duplicate want-ref %s",
1528 refname_nons);
1529 die("duplicate want-ref %s", refname_nons);
1530 }
1531
1532 if (!starts_with(refname_nons, "refs/tags/")) {
1533 struct commit *commit = lookup_commit_in_graph(the_repository, &oid);
1534 if (commit)
1535 o = &commit->object;
1536 }
1537
1538 if (!o)
1539 o = parse_object_or_die(the_repository, &oid, refname_nons);
1540
1541 if (!(o->flags & WANTED)) {
1542 o->flags |= WANTED;
1543 add_object_array(o, NULL, want_obj);
1544 }
1545
1546 return 1;
1547 }
1548
1549 return 0;
1550}
1551
1552static int parse_have(const char *line, struct upload_pack_data *data)
1553{

Callers 1

process_argsFunction · 0.85

Calls 14

strbuf_addfFunction · 0.85
get_git_namespaceFunction · 0.85
ref_is_hiddenFunction · 0.85
refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
packet_writer_errorFunction · 0.85
strbuf_releaseFunction · 0.85
strmap_putFunction · 0.85
oiddupFunction · 0.85
starts_withFunction · 0.85
lookup_commit_in_graphFunction · 0.85
parse_object_or_dieFunction · 0.85

Tested by

no test coverage detected