blob: 11905783989aa0d87be08e0c4311762b4647e9a4 [file] [log] [blame]
Johan Herland49c24702013-06-12 02:13:00 +02001#ifndef NOTES_UTILS_H
2#define NOTES_UTILS_H
3
4#include "notes.h"
5
Johan Herlandbf9a05b2013-06-12 02:13:01 +02006/*
7 * Create new notes commit from the given notes tree
8 *
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.
Junio C Hamanoa316b952013-09-04 15:28:45 -070012 * - author/committer: the default determined by commit_tree().
Johan Herlandbf9a05b2013-06-12 02:13:01 +020013 * - commit message: msg
14 *
15 * The resulting commit SHA1 is stored in result_sha1.
16 */
17void create_notes_commit(struct notes_tree *t, struct commit_list *parents,
Jeff King3ffefb52014-06-10 17:36:52 -040018 const char *msg, size_t msg_len, unsigned char *result_sha1);
Johan Herlandbf9a05b2013-06-12 02:13:01 +020019
Johan Herland49c24702013-06-12 02:13:00 +020020void commit_notes(struct notes_tree *t, const char *msg);
21
Jacob Keller4d03dd12015-08-17 14:33:30 -070022enum notes_merge_strategy {
23 NOTES_MERGE_RESOLVE_MANUAL = 0,
24 NOTES_MERGE_RESOLVE_OURS,
25 NOTES_MERGE_RESOLVE_THEIRS,
26 NOTES_MERGE_RESOLVE_UNION,
27 NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
28};
29
Johan Herland49c24702013-06-12 02:13:00 +020030struct notes_rewrite_cfg {
31 struct notes_tree **trees;
32 const char *cmd;
33 int enabled;
34 combine_notes_fn combine;
35 struct string_list *refs;
36 int refs_from_env;
37 int mode_from_env;
38};
39
Jacob Keller93efcad2015-08-17 14:33:31 -070040int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s);
Johan Herland49c24702013-06-12 02:13:00 +020041struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
42int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
brian m. carlsonbb7e4732017-05-30 10:30:42 -070043 const struct object_id *from_obj, const struct object_id *to_obj);
Johan Herland49c24702013-06-12 02:13:00 +020044void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c, const char *msg);
45
46#endif