Merge branch 'jt/fetch-nego-tip' into ab/fetch-nego
[alt-git.git] / notes-utils.h
blob5d79cbef512e3bdbbfafedbd7650036aff695f83
1 #ifndef NOTES_UTILS_H
2 #define NOTES_UTILS_H
4 #include "notes.h"
6 /*
7 * Create new notes commit from the given notes tree
9 * Properties of the created commit:
10 * - tree: the result of converting t to a tree object with write_notes_tree().
11 * - parents: the given parents OR (if NULL) the commit referenced by t->ref.
12 * - author/committer: the default determined by commit_tree().
13 * - commit message: msg
15 * The resulting commit SHA1 is stored in result_sha1.
17 void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
18 const char *msg, size_t msg_len,
19 struct object_id *result_oid);
21 void commit_notes(struct notes_tree *t, const char *msg);
23 enum notes_merge_strategy {
24 NOTES_MERGE_RESOLVE_MANUAL = 0,
25 NOTES_MERGE_RESOLVE_OURS,
26 NOTES_MERGE_RESOLVE_THEIRS,
27 NOTES_MERGE_RESOLVE_UNION,
28 NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
31 struct notes_rewrite_cfg {
32 struct notes_tree **trees;
33 const char *cmd;
34 int enabled;
35 combine_notes_fn combine;
36 struct string_list *refs;
37 int refs_from_env;
38 int mode_from_env;
41 int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s);
42 struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
43 int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
44 const struct object_id *from_obj, const struct object_id *to_obj);
45 void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c, const char *msg);
47 #endif