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

Function commit_notes

notes-utils.c:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void commit_notes(struct repository *r, struct notes_tree *t, const char *msg)
47{
48 struct strbuf buf = STRBUF_INIT;
49 struct object_id commit_oid;
50
51 if (!t)
52 t = &default_notes_tree;
53 if (!t->initialized || !t->update_ref || !*t->update_ref)
54 die(_("Cannot commit uninitialized/unreferenced notes tree"));
55 if (!t->dirty)
56 return; /* don't have to commit an unchanged tree */
57
58 /* Prepare commit message and reflog message */
59 strbuf_addstr(&buf, msg);
60 strbuf_complete_line(&buf);
61
62 create_notes_commit(r, t, NULL, buf.buf, buf.len, &commit_oid);
63 strbuf_insertstr(&buf, 0, "notes: ");
64 refs_update_ref(get_main_ref_store(the_repository), buf.buf,
65 t->update_ref, &commit_oid, NULL, 0,
66 UPDATE_REFS_DIE_ON_ERR);
67
68 strbuf_release(&buf);
69}
70
71int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s)
72{

Callers 7

notes_copy_from_stdinFunction · 0.85
addFunction · 0.85
copyFunction · 0.85
append_editFunction · 0.85
remove_cmdFunction · 0.85
pruneFunction · 0.85

Calls 8

strbuf_addstrFunction · 0.85
strbuf_complete_lineFunction · 0.85
create_notes_commitFunction · 0.85
strbuf_insertstrFunction · 0.85
refs_update_refFunction · 0.85
get_main_ref_storeFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected