]> git.ipfire.org Git - thirdparty/git.git/blame - notes-utils.h
strbuf.cocci: suggest strbuf_addbuf() to add one strbuf to an other
[thirdparty/git.git] / notes-utils.h
CommitLineData
49c24704
JH
1#ifndef NOTES_UTILS_H
2#define NOTES_UTILS_H
3
4#include "notes.h"
5
ef3ca954
EN
6struct commit_list;
7struct object_id;
8
bf9a05ba
JH
9/*
10 * Create new notes commit from the given notes tree
11 *
12 * Properties of the created commit:
13 * - tree: the result of converting t to a tree object with write_notes_tree().
14 * - parents: the given parents OR (if NULL) the commit referenced by t->ref.
a316b954 15 * - author/committer: the default determined by commit_tree().
bf9a05ba
JH
16 * - commit message: msg
17 *
18 * The resulting commit SHA1 is stored in result_sha1.
19 */
20void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
5078f344
PO
21 const char *msg, size_t msg_len,
22 struct object_id *result_oid);
bf9a05ba 23
49c24704
JH
24void commit_notes(struct notes_tree *t, const char *msg);
25
4d03dd18
JK
26enum notes_merge_strategy {
27 NOTES_MERGE_RESOLVE_MANUAL = 0,
28 NOTES_MERGE_RESOLVE_OURS,
29 NOTES_MERGE_RESOLVE_THEIRS,
30 NOTES_MERGE_RESOLVE_UNION,
31 NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
32};
33
49c24704
JH
34struct notes_rewrite_cfg {
35 struct notes_tree **trees;
36 const char *cmd;
37 int enabled;
38 combine_notes_fn combine;
39 struct string_list *refs;
40 int refs_from_env;
41 int mode_from_env;
42};
43
93efcad3 44int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s);
49c24704
JH
45struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
46int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
bb7e4739 47 const struct object_id *from_obj, const struct object_id *to_obj);
49c24704
JH
48void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c, const char *msg);
49
50#endif