| 1470 | } |
| 1471 | |
| 1472 | static 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 | |
| 1507 | static int parse_want_ref(struct packet_writer *writer, const char *line, |
| 1508 | struct strmap *wanted_refs, |
no test coverage detected