Imported Upstream version 2.23.3
[platform/upstream/git.git] / notes-merge.h
index 1d01f6a..99f9c70 100644 (file)
@@ -1,6 +1,13 @@
 #ifndef NOTES_MERGE_H
 #define NOTES_MERGE_H
 
+#include "notes-utils.h"
+#include "strbuf.h"
+
+struct commit;
+struct object_id;
+struct repository;
+
 #define NOTES_MERGE_WORKTREE "NOTES_MERGE_WORKTREE"
 
 enum notes_merge_verbosity {
@@ -9,21 +16,17 @@ enum notes_merge_verbosity {
 };
 
 struct notes_merge_options {
+       struct repository *repo;
        const char *local_ref;
        const char *remote_ref;
        struct strbuf commit_msg;
        int verbosity;
-       enum {
-               NOTES_MERGE_RESOLVE_MANUAL = 0,
-               NOTES_MERGE_RESOLVE_OURS,
-               NOTES_MERGE_RESOLVE_THEIRS,
-               NOTES_MERGE_RESOLVE_UNION,
-               NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
-       } strategy;
+       enum notes_merge_strategy strategy;
        unsigned has_worktree:1;
 };
 
-void init_notes_merge_options(struct notes_merge_options *o);
+void init_notes_merge_options(struct repository *r,
+                             struct notes_merge_options *o);
 
 /*
  * Merge notes from o->remote_ref into o->local_ref
@@ -36,16 +39,16 @@ void init_notes_merge_options(struct notes_merge_options *o);
  * outcomes:
  *
  * 1. The merge trivially results in an existing commit (e.g. fast-forward or
- *    already-up-to-date). 'local_tree' is untouched, the SHA1 of the result
- *    is written into 'result_sha1' and 0 is returned.
+ *    already-up-to-date). 'local_tree' is untouched, the OID of the result
+ *    is written into 'result_oid' and 0 is returned.
  * 2. The merge successfully completes, producing a merge commit. local_tree
- *    contains the updated notes tree, the SHA1 of the resulting commit is
- *    written into 'result_sha1', and 1 is returned.
+ *    contains the updated notes tree, the OID of the resulting commit is
+ *    written into 'result_oid', and 1 is returned.
  * 3. The merge results in conflicts. This is similar to #2 in that the
  *    partial merge result (i.e. merge result minus the unmerged entries)
- *    are stored in 'local_tree', and the SHA1 or the resulting commit
+ *    are stored in 'local_tree', and the OID or the resulting commit
  *    (to be amended when the conflicts have been resolved) is written into
- *    'result_sha1'. The unmerged entries are written into the
+ *    'result_oid'. The unmerged entries are written into the
  *    .git/NOTES_MERGE_WORKTREE directory with conflict markers.
  *    -1 is returned.
  *
@@ -56,7 +59,7 @@ void init_notes_merge_options(struct notes_merge_options *o);
  */
 int notes_merge(struct notes_merge_options *o,
                struct notes_tree *local_tree,
-               unsigned char *result_sha1);
+               struct object_id *result_oid);
 
 /*
  * Finalize conflict resolution from an earlier notes_merge()
@@ -66,13 +69,13 @@ int notes_merge(struct notes_merge_options *o,
  * call to notes_merge().
  *
  * This function will add the (now resolved) notes in .git/NOTES_MERGE_WORKTREE
- * to 'partial_tree', and create a final notes merge commit, the SHA1 of which
- * will be stored in 'result_sha1'.
+ * to 'partial_tree', and create a final notes merge commit, the OID of which
+ * will be stored in 'result_oid'.
  */
 int notes_merge_commit(struct notes_merge_options *o,
                       struct notes_tree *partial_tree,
                       struct commit *partial_commit,
-                      unsigned char *result_sha1);
+                      struct object_id *result_oid);
 
 /*
  * Abort conflict resolution from an earlier notes_merge()