Johan Herland | 49c2470 | 2013-06-12 02:13:00 +0200 | [diff] [blame] | 1 | #ifndef NOTES_UTILS_H |
| 2 | #define NOTES_UTILS_H |
| 3 | |
| 4 | #include "notes.h" |
| 5 | |
Elijah Newren | ef3ca95 | 2018-08-15 10:54:05 -0700 | [diff] [blame] | 6 | struct commit_list; |
| 7 | struct object_id; |
Nguyễn Thái Ngọc Duy | 1d18d75 | 2019-01-12 09:13:23 +0700 | [diff] [blame] | 8 | struct repository; |
Elijah Newren | ef3ca95 | 2018-08-15 10:54:05 -0700 | [diff] [blame] | 9 | |
Johan Herland | bf9a05b | 2013-06-12 02:13:01 +0200 | [diff] [blame] | 10 | /* |
| 11 | * Create new notes commit from the given notes tree |
| 12 | * |
| 13 | * Properties of the created commit: |
| 14 | * - tree: the result of converting t to a tree object with write_notes_tree(). |
| 15 | * - parents: the given parents OR (if NULL) the commit referenced by t->ref. |
Junio C Hamano | a316b95 | 2013-09-04 15:28:45 -0700 | [diff] [blame] | 16 | * - author/committer: the default determined by commit_tree(). |
Johan Herland | bf9a05b | 2013-06-12 02:13:01 +0200 | [diff] [blame] | 17 | * - commit message: msg |
| 18 | * |
| 19 | * The resulting commit SHA1 is stored in result_sha1. |
| 20 | */ |
Nguyễn Thái Ngọc Duy | 1d18d75 | 2019-01-12 09:13:23 +0700 | [diff] [blame] | 21 | void create_notes_commit(struct repository *r, |
| 22 | struct notes_tree *t, |
| 23 | struct commit_list *parents, |
Patryk Obara | 5078f34 | 2018-01-28 01:13:16 +0100 | [diff] [blame] | 24 | const char *msg, size_t msg_len, |
| 25 | struct object_id *result_oid); |
Johan Herland | bf9a05b | 2013-06-12 02:13:01 +0200 | [diff] [blame] | 26 | |
Nguyễn Thái Ngọc Duy | 1d18d75 | 2019-01-12 09:13:23 +0700 | [diff] [blame] | 27 | void commit_notes(struct repository *r, struct notes_tree *t, const char *msg); |
Johan Herland | 49c2470 | 2013-06-12 02:13:00 +0200 | [diff] [blame] | 28 | |
Jacob Keller | 4d03dd1 | 2015-08-17 14:33:30 -0700 | [diff] [blame] | 29 | enum notes_merge_strategy { |
| 30 | NOTES_MERGE_RESOLVE_MANUAL = 0, |
| 31 | NOTES_MERGE_RESOLVE_OURS, |
| 32 | NOTES_MERGE_RESOLVE_THEIRS, |
| 33 | NOTES_MERGE_RESOLVE_UNION, |
| 34 | NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ |
| 35 | }; |
| 36 | |
Johan Herland | 49c2470 | 2013-06-12 02:13:00 +0200 | [diff] [blame] | 37 | struct notes_rewrite_cfg { |
| 38 | struct notes_tree **trees; |
| 39 | const char *cmd; |
| 40 | int enabled; |
| 41 | combine_notes_fn combine; |
| 42 | struct string_list *refs; |
| 43 | int refs_from_env; |
| 44 | int mode_from_env; |
| 45 | }; |
| 46 | |
Jacob Keller | 93efcad | 2015-08-17 14:33:31 -0700 | [diff] [blame] | 47 | int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s); |
Johan Herland | 49c2470 | 2013-06-12 02:13:00 +0200 | [diff] [blame] | 48 | struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd); |
| 49 | int copy_note_for_rewrite(struct notes_rewrite_cfg *c, |
brian m. carlson | bb7e473 | 2017-05-30 10:30:42 -0700 | [diff] [blame] | 50 | const struct object_id *from_obj, const struct object_id *to_obj); |
Nguyễn Thái Ngọc Duy | 1d18d75 | 2019-01-12 09:13:23 +0700 | [diff] [blame] | 51 | void finish_copy_notes_for_rewrite(struct repository *r, |
| 52 | struct notes_rewrite_cfg *c, |
| 53 | const char *msg); |
Johan Herland | 49c2470 | 2013-06-12 02:13:00 +0200 | [diff] [blame] | 54 | |
| 55 | #endif |