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

Function parse_want

upload-pack.c:1472–1505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1470}
1471
1472static int parse_want(struct packet_writer *writer, const char *line,
1473 struct object_array *want_obj)
1474{
1475 const char *arg;
1476 if (skip_prefix(line, "want ", &arg)) {
1477 struct object_id oid;
1478 struct object *o;
1479
1480 if (get_oid_hex(arg, &oid))
1481 die("git upload-pack: protocol error, "
1482 "expected to get oid, not '%s'", line);
1483
1484 o = parse_object_with_flags(the_repository, &oid,
1485 PARSE_OBJECT_SKIP_HASH_CHECK |
1486 PARSE_OBJECT_DISCARD_TREE);
1487
1488 if (!o) {
1489 packet_writer_error(writer,
1490 "upload-pack: not our ref %s",
1491 oid_to_hex(&oid));
1492 die("git upload-pack: not our ref %s",
1493 oid_to_hex(&oid));
1494 }
1495
1496 if (!(o->flags & WANTED)) {
1497 o->flags |= WANTED;
1498 add_object_array(o, NULL, want_obj);
1499 }
1500
1501 return 1;
1502 }
1503
1504 return 0;
1505}
1506
1507static int parse_want_ref(struct packet_writer *writer, const char *line,
1508 struct strmap *wanted_refs,

Callers 1

process_argsFunction · 0.85

Calls 6

get_oid_hexFunction · 0.85
parse_object_with_flagsFunction · 0.85
packet_writer_errorFunction · 0.85
oid_to_hexFunction · 0.85
add_object_arrayFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected