| 464 | } |
| 465 | |
| 466 | static void parse_cmd_delete(struct ref_transaction *transaction, |
| 467 | const char *next, const char *end, |
| 468 | struct command_options *opts UNUSED) |
| 469 | { |
| 470 | struct strbuf err = STRBUF_INIT; |
| 471 | char *refname; |
| 472 | struct object_id old_oid; |
| 473 | int have_old; |
| 474 | |
| 475 | refname = parse_refname(&next); |
| 476 | if (!refname) |
| 477 | die("delete: missing <ref>"); |
| 478 | |
| 479 | if (parse_next_oid(&next, end, &old_oid, "delete", refname, |
| 480 | PARSE_SHA1_OLD)) { |
| 481 | have_old = 0; |
| 482 | } else { |
| 483 | if (is_null_oid(&old_oid)) |
| 484 | die("delete %s: zero <old-oid>", refname); |
| 485 | have_old = 1; |
| 486 | } |
| 487 | |
| 488 | if (*next != line_termination) |
| 489 | die("delete %s: extra input: %s", refname, next); |
| 490 | |
| 491 | if (ref_transaction_delete(transaction, refname, |
| 492 | have_old ? &old_oid : NULL, |
| 493 | NULL, update_flags, msg, &err)) |
| 494 | die("%s", err.buf); |
| 495 | |
| 496 | update_flags = default_flags; |
| 497 | free(refname); |
| 498 | strbuf_release(&err); |
| 499 | } |
| 500 | |
| 501 | static void parse_cmd_symref_delete(struct ref_transaction *transaction, |
| 502 | const char *next, const char *end UNUSED, |
nothing calls this directly
no test coverage detected