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

Function parse_cmd_delete

builtin/update-ref.c:466–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466static 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
501static void parse_cmd_symref_delete(struct ref_transaction *transaction,
502 const char *next, const char *end UNUSED,

Callers

nothing calls this directly

Calls 6

parse_refnameFunction · 0.85
parse_next_oidFunction · 0.85
is_null_oidFunction · 0.85
ref_transaction_deleteFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected