MCPcopy Create free account
hub / github.com/git/git / parse_cmd_symref_verify

Function parse_cmd_symref_verify

builtin/update-ref.c:558–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556}
557
558static void parse_cmd_symref_verify(struct ref_transaction *transaction,
559 const char *next, const char *end UNUSED,
560 struct command_options *opts UNUSED)
561{
562 struct strbuf err = STRBUF_INIT;
563 struct object_id old_oid;
564 char *refname, *old_target;
565
566 if (!(update_flags & REF_NO_DEREF))
567 die("symref-verify: cannot operate with deref mode");
568
569 refname = parse_refname(&next);
570 if (!refname)
571 die("symref-verify: missing <ref>");
572
573 /*
574 * old_ref is optional, if not provided, we need to ensure that the
575 * ref doesn't exist.
576 */
577 old_target = parse_next_refname(&next);
578 if (!old_target)
579 oidcpy(&old_oid, null_oid(the_hash_algo));
580
581 if (*next != line_termination)
582 die("symref-verify %s: extra input: %s", refname, next);
583
584 if (ref_transaction_verify(transaction, refname,
585 old_target ? NULL : &old_oid,
586 old_target, update_flags, &err))
587 die("%s", err.buf);
588
589 update_flags = default_flags;
590 free(refname);
591 free(old_target);
592 strbuf_release(&err);
593}
594
595static void report_ok(const char *command)
596{

Callers

nothing calls this directly

Calls 7

parse_refnameFunction · 0.85
parse_next_refnameFunction · 0.85
oidcpyFunction · 0.85
null_oidFunction · 0.85
ref_transaction_verifyFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected