summaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
Diffstat (limited to 'notes-merge.c')
-rw-r--r--notes-merge.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/notes-merge.c b/notes-merge.c
index b4a3a90..5128293 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -1,16 +1,23 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
#include "commit.h"
+#include "gettext.h"
#include "refs.h"
-#include "object-store.h"
+#include "object-file.h"
+#include "object-name.h"
+#include "object-store-ll.h"
+#include "path.h"
#include "repository.h"
#include "diff.h"
#include "diffcore.h"
+#include "hex.h"
#include "xdiff-interface.h"
-#include "ll-merge.h"
+#include "merge-ll.h"
#include "dir.h"
#include "notes.h"
#include "notes-merge.h"
#include "strbuf.h"
+#include "trace.h"
#include "notes-utils.h"
#include "commit-reach.h"
@@ -113,6 +120,7 @@ static struct notes_merge_pair *find_notes_merge_pair_pos(
}
static struct object_id uninitialized = {
+ .hash =
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
};
@@ -175,7 +183,6 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
oid_to_hex(&mp->remote));
}
diff_flush(&opt);
- clear_pathspec(&opt.pathspec);
*num_changes = len;
return changes;
@@ -261,7 +268,6 @@ static void diff_tree_local(struct notes_merge_options *o,
oid_to_hex(&mp->local));
}
diff_flush(&opt);
- clear_pathspec(&opt.pathspec);
}
static void check_notes_merge_worktree(struct notes_merge_options *o)
@@ -327,7 +333,7 @@ static void write_note_to_worktree(const struct object_id *obj,
{
enum object_type type;
unsigned long size;
- void *buf = read_object_file(note, &type, &size);
+ void *buf = repo_read_object_file(the_repository, note, &type, &size);
if (!buf)
die("cannot read note %s for object %s",
@@ -344,7 +350,7 @@ static int ll_merge_in_worktree(struct notes_merge_options *o,
{
mmbuffer_t result_buf;
mmfile_t base, local, remote;
- int status;
+ enum ll_merge_result status;
read_mmblob(&base, &p->base);
read_mmblob(&local, &p->local);
@@ -358,6 +364,9 @@ static int ll_merge_in_worktree(struct notes_merge_options *o,
free(local.ptr);
free(remote.ptr);
+ if (status == LL_MERGE_BINARY_CONFLICT)
+ warning("Cannot merge binary files: %s (%s vs. %s)",
+ oid_to_hex(&p->obj), o->local_ref, o->remote_ref);
if ((status < 0) || !result_buf.ptr)
die("Failed to execute internal merge");
@@ -564,7 +573,7 @@ int notes_merge(struct notes_merge_options *o,
trace_printf("\tlocal commit: %.7s\n", oid_to_hex(&local_oid));
/* Dereference o->remote_ref into remote_oid */
- if (get_oid(o->remote_ref, &remote_oid)) {
+ if (repo_get_oid(the_repository, o->remote_ref, &remote_oid)) {
/*
* Failed to get remote_oid. If o->remote_ref looks like an
* unborn ref, perform the merge using an empty notes tree.
@@ -598,7 +607,8 @@ int notes_merge(struct notes_merge_options *o,
assert(local && remote);
/* Find merge bases */
- bases = get_merge_bases(local, remote);
+ if (repo_get_merge_bases(the_repository, local, remote, &bases) < 0)
+ exit(128);
if (!bases) {
base_oid = null_oid();
base_tree_oid = the_hash_algo->empty_tree;
@@ -676,7 +686,8 @@ int notes_merge_commit(struct notes_merge_options *o,
DIR *dir;
struct dirent *e;
struct strbuf path = STRBUF_INIT;
- const char *buffer = get_commit_buffer(partial_commit, NULL);
+ const char *buffer = repo_get_commit_buffer(the_repository,
+ partial_commit, NULL);
const char *msg = strstr(buffer, "\n\n");
int baselen;
@@ -723,7 +734,7 @@ int notes_merge_commit(struct notes_merge_options *o,
create_notes_commit(o->repo, partial_tree, partial_commit->parents, msg,
strlen(msg), result_oid);
- unuse_commit_buffer(partial_commit, buffer);
+ repo_unuse_commit_buffer(the_repository, partial_commit, buffer);
if (o->verbosity >= 4)
printf("Finalized notes merge commit: %s\n",
oid_to_hex(result_oid));