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

Function lookup_label

sequencer.c:3985–4005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3983}
3984
3985static struct commit *lookup_label(struct repository *r, const char *label,
3986 int len, struct strbuf *buf)
3987{
3988 struct commit *commit;
3989 struct object_id oid;
3990
3991 strbuf_reset(buf);
3992 strbuf_addf(buf, "refs/rewritten/%.*s", len, label);
3993 if (!refs_read_ref(get_main_ref_store(the_repository), buf->buf, &oid)) {
3994 commit = lookup_commit_object(r, &oid);
3995 } else {
3996 /* fall back to non-rewritten ref or commit */
3997 strbuf_splice(buf, 0, strlen("refs/rewritten/"), "", 0);
3998 commit = lookup_commit_reference_by_name(buf->buf);
3999 }
4000
4001 if (!commit)
4002 error(_("could not resolve '%s'"), buf->buf);
4003
4004 return commit;
4005}
4006
4007static int do_reset(struct repository *r,
4008 const char *name, int len,

Callers 2

do_resetFunction · 0.85
do_mergeFunction · 0.85

Calls 7

strbuf_addfFunction · 0.85
refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
lookup_commit_objectFunction · 0.85
strbuf_spliceFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected