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

Function notes_cache_match_validity

notes-cache.c:13–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "strbuf.h"
12
13static int notes_cache_match_validity(struct repository *r,
14 const char *ref,
15 const char *validity)
16{
17 struct object_id oid;
18 struct commit *commit;
19 struct pretty_print_context pretty_ctx;
20 struct strbuf msg = STRBUF_INIT;
21 int ret;
22
23 if (refs_read_ref(get_main_ref_store(the_repository), ref, &oid) < 0)
24 return 0;
25
26 commit = lookup_commit_reference_gently(r, &oid, 1);
27 if (!commit)
28 return 0;
29
30 memset(&pretty_ctx, 0, sizeof(pretty_ctx));
31 repo_format_commit_message(r, commit, "%s", &msg,
32 &pretty_ctx);
33 strbuf_trim(&msg);
34
35 ret = !strcmp(msg.buf, validity);
36 strbuf_release(&msg);
37
38 return ret;
39}
40
41void notes_cache_init(struct repository *r, struct notes_cache *c,
42 const char *name, const char *validity)

Callers 1

notes_cache_initFunction · 0.85

Calls 6

refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
strbuf_trimFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected