Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 85 lines (76 sloc) 2.998 kB
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
1 #ifndef NOTES_MERGE_H
2 #define NOTES_MERGE_H
3
809f38c @jherland git notes merge: Manual conflict resolution, part 1/2
jherland authored
4 #define NOTES_MERGE_WORKTREE "NOTES_MERGE_WORKTREE"
5
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
6 enum notes_merge_verbosity {
7 NOTES_MERGE_VERBOSITY_DEFAULT = 2,
8 NOTES_MERGE_VERBOSITY_MAX = 5
9 };
10
11 struct notes_merge_options {
12 const char *local_ref;
13 const char *remote_ref;
443259c @jherland git notes merge: List conflicting notes in notes merge commit message
jherland authored
14 struct strbuf commit_msg;
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
15 int verbosity;
3228e67 @jherland git notes merge: Add automatic conflict resolvers (ours, theirs, union)
jherland authored
16 enum {
17 NOTES_MERGE_RESOLVE_MANUAL = 0,
18 NOTES_MERGE_RESOLVE_OURS,
19 NOTES_MERGE_RESOLVE_THEIRS,
a6a0909 @jherland git notes merge: Add another auto-resolving strategy: "cat_sort_uniq"
jherland authored
20 NOTES_MERGE_RESOLVE_UNION,
21 NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
3228e67 @jherland git notes merge: Add automatic conflict resolvers (ours, theirs, union)
jherland authored
22 } strategy;
809f38c @jherland git notes merge: Manual conflict resolution, part 1/2
jherland authored
23 unsigned has_worktree:1;
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
24 };
25
26 void init_notes_merge_options(struct notes_merge_options *o);
27
28 /*
29 * Merge notes from o->remote_ref into o->local_ref
30 *
2085b16 @jherland git notes merge: Handle real, non-conflicting notes merges
jherland authored
31 * The given notes_tree 'local_tree' must be the notes_tree referenced by the
32 * o->local_ref. This is the notes_tree in which the object-level merge is
33 * performed.
34 *
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
35 * The commits given by the two refs are merged, producing one of the following
36 * outcomes:
37 *
38 * 1. The merge trivially results in an existing commit (e.g. fast-forward or
2085b16 @jherland git notes merge: Handle real, non-conflicting notes merges
jherland authored
39 * already-up-to-date). 'local_tree' is untouched, the SHA1 of the result
40 * is written into 'result_sha1' and 0 is returned.
41 * 2. The merge successfully completes, producing a merge commit. local_tree
42 * contains the updated notes tree, the SHA1 of the resulting commit is
43 * written into 'result_sha1', and 1 is returned.
809f38c @jherland git notes merge: Manual conflict resolution, part 1/2
jherland authored
44 * 3. The merge results in conflicts. This is similar to #2 in that the
45 * partial merge result (i.e. merge result minus the unmerged entries)
46 * are stored in 'local_tree', and the SHA1 or the resulting commit
47 * (to be amended when the conflicts have been resolved) is written into
48 * 'result_sha1'. The unmerged entries are written into the
49 * .git/NOTES_MERGE_WORKTREE directory with conflict markers.
50 * -1 is returned.
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
51 *
52 * Both o->local_ref and o->remote_ref must be given (non-NULL), but either ref
53 * (although not both) may refer to a non-existing notes ref, in which case
54 * that notes ref is interpreted as an empty notes tree, and the merge
55 * trivially results in what the other ref points to.
56 */
57 int notes_merge(struct notes_merge_options *o,
2085b16 @jherland git notes merge: Handle real, non-conflicting notes merges
jherland authored
58 struct notes_tree *local_tree,
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
59 unsigned char *result_sha1);
60
6abb365 @jherland git notes merge: Manual conflict resolution, part 2/2
jherland authored
61 /*
62 * Finalize conflict resolution from an earlier notes_merge()
63 *
64 * The given notes tree 'partial_tree' must be the notes_tree corresponding to
65 * the given 'partial_commit', the partial result commit created by a previous
66 * call to notes_merge().
67 *
68 * This function will add the (now resolved) notes in .git/NOTES_MERGE_WORKTREE
69 * to 'partial_tree', and create a final notes merge commit, the SHA1 of which
70 * will be stored in 'result_sha1'.
71 */
72 int notes_merge_commit(struct notes_merge_options *o,
73 struct notes_tree *partial_tree,
74 struct commit *partial_commit,
75 unsigned char *result_sha1);
76
77 /*
78 * Abort conflict resolution from an earlier notes_merge()
79 *
80 * Removes the notes merge worktree in .git/NOTES_MERGE_WORKTREE.
81 */
82 int notes_merge_abort(struct notes_merge_options *o);
83
75ef3f4 @jherland git notes merge: Initial implementation handling trivial merges only
jherland authored
84 #endif
Something went wrong with that request. Please try again.