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

Function create_notes_commit

notes-utils.c:12–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "strbuf.h"
11
12void create_notes_commit(struct repository *r,
13 struct notes_tree *t,
14 const struct commit_list *parents,
15 const char *msg, size_t msg_len,
16 struct object_id *result_oid)
17{
18 struct commit_list *parents_to_free = NULL;
19 struct object_id tree_oid;
20
21 assert(t->initialized);
22
23 if (write_notes_tree(t, &tree_oid))
24 die("Failed to write notes tree to database");
25
26 if (!parents) {
27 /* Deduce parent commit from t->ref */
28 struct object_id parent_oid;
29 if (!refs_read_ref(get_main_ref_store(the_repository), t->ref, &parent_oid)) {
30 struct commit *parent = lookup_commit(r, &parent_oid);
31 if (repo_parse_commit(r, parent))
32 die("Failed to find/parse commit %s", t->ref);
33 commit_list_insert(parent, &parents_to_free);
34 parents = parents_to_free;
35 }
36 /* else: t->ref points to nothing, assume root/orphan commit */
37 }
38
39 if (commit_tree(msg, msg_len, &tree_oid, parents, result_oid, NULL,
40 NULL))
41 die("Failed to commit notes tree to database");
42
43 commit_list_free(parents_to_free);
44}
45
46void commit_notes(struct repository *r, struct notes_tree *t, const char *msg)
47{

Callers 3

notes_mergeFunction · 0.85
notes_merge_commitFunction · 0.85
commit_notesFunction · 0.85

Calls 9

write_notes_treeFunction · 0.85
refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
lookup_commitFunction · 0.85
repo_parse_commitFunction · 0.85
commit_list_insertFunction · 0.85
commit_treeFunction · 0.85
commit_list_freeFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected