git notes merge: Initial implementation handling trivial merges only
[git/git.git] / notes-merge.h
CommitLineData
75ef3f4a
JH
1#ifndef NOTES_MERGE_H
2#define NOTES_MERGE_H
3
4enum notes_merge_verbosity {
5 NOTES_MERGE_VERBOSITY_DEFAULT = 2,
6 NOTES_MERGE_VERBOSITY_MAX = 5
7};
8
9struct notes_merge_options {
10 const char *local_ref;
11 const char *remote_ref;
12 int verbosity;
13};
14
15void init_notes_merge_options(struct notes_merge_options *o);
16
17/*
18 * Merge notes from o->remote_ref into o->local_ref
19 *
20 * The commits given by the two refs are merged, producing one of the following
21 * outcomes:
22 *
23 * 1. The merge trivially results in an existing commit (e.g. fast-forward or
24 * already-up-to-date). The SHA1 of the result is written into 'result_sha1'
25 * and 0 is returned.
26 * 2. The merge fails. result_sha1 is set to null_sha1, and non-zero returned.
27 *
28 * Both o->local_ref and o->remote_ref must be given (non-NULL), but either ref
29 * (although not both) may refer to a non-existing notes ref, in which case
30 * that notes ref is interpreted as an empty notes tree, and the merge
31 * trivially results in what the other ref points to.
32 */
33int notes_merge(struct notes_merge_options *o,
34 unsigned char *result_sha1);
35
36#endif