summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index ed64a4c537..9d1e809bd2 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -5,6 +5,7 @@
*/
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "merge-recursive.h"
@@ -501,7 +502,7 @@ static int get_tree_entry_if_blob(struct repository *r,
ret = get_tree_entry(r, tree, path, &dfs->oid, &dfs->mode);
if (S_ISDIR(dfs->mode)) {
- oidcpy(&dfs->oid, null_oid());
+ oidcpy(&dfs->oid, null_oid(the_hash_algo));
dfs->mode = 0;
}
return ret;
@@ -1196,7 +1197,7 @@ static void print_commit(struct repository *repo, struct commit *commit)
struct pretty_print_context ctx = {0};
ctx.date_mode.type = DATE_NORMAL;
/* FIXME: Merge this with output_commit_title() */
- assert(!merge_remote_util(commit));
+ ASSERT(!merge_remote_util(commit));
repo_format_commit_message(repo, commit, " %h: %m %s", &sb, &ctx);
fprintf(stderr, "%s\n", sb.buf);
strbuf_release(&sb);
@@ -1237,7 +1238,7 @@ static int merge_submodule(struct merge_options *opt,
if (is_null_oid(b))
return 0;
- if (repo_submodule_init(&subrepo, opt->repo, path, null_oid())) {
+ if (repo_submodule_init(&subrepo, opt->repo, path, null_oid(the_hash_algo))) {
output(opt, 1, _("Failed to merge submodule %s (not checked out)"), path);
return 0;
}
@@ -1697,7 +1698,7 @@ static int handle_file_collision(struct merge_options *opt,
/* Store things in diff_filespecs for functions that need it */
null.path = (char *)collide_path;
- oidcpy(&null.oid, null_oid());
+ oidcpy(&null.oid, null_oid(the_hash_algo));
null.mode = 0;
if (merge_mode_and_contents(opt, &null, a, b, collide_path,
@@ -2757,23 +2758,22 @@ static int process_renames(struct merge_options *opt,
const struct rename *sre;
/*
- * FIXME: As string-list.h notes, it's O(n^2) to build a sorted
- * string_list one-by-one, but O(n log n) to build it unsorted and
- * then sort it. Note that as we build the list, we do not need to
- * check if the existing destination path is already in the list,
- * because the structure of diffcore_rename guarantees we won't
- * have duplicates.
+ * Note that as we build the list, we do not need to check if the
+ * existing destination path is already in the list, because the
+ * structure of diffcore_rename guarantees we won't have duplicates.
*/
for (i = 0; i < a_renames->nr; i++) {
sre = a_renames->items[i].util;
- string_list_insert(&a_by_dst, sre->pair->two->path)->util
+ string_list_append(&a_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
for (i = 0; i < b_renames->nr; i++) {
sre = b_renames->items[i].util;
- string_list_insert(&b_by_dst, sre->pair->two->path)->util
+ string_list_append(&b_by_dst, sre->pair->two->path)->util
= (void *)sre;
}
+ string_list_sort(&a_by_dst);
+ string_list_sort(&b_by_dst);
for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
struct string_list *renames1, *renames2Dst;
@@ -2897,14 +2897,14 @@ static int process_renames(struct merge_options *opt,
dst_other.mode = ren1->dst_entry->stages[other_stage].mode;
try_merge = 0;
- if (oideq(&src_other.oid, null_oid()) &&
+ if (oideq(&src_other.oid, null_oid(the_hash_algo)) &&
ren1->dir_rename_original_type == 'A') {
setup_rename_conflict_info(RENAME_VIA_DIR,
opt, ren1, NULL);
} else if (renamed_to_self) {
setup_rename_conflict_info(RENAME_NORMAL,
opt, ren1, NULL);
- } else if (oideq(&src_other.oid, null_oid())) {
+ } else if (oideq(&src_other.oid, null_oid(the_hash_algo))) {
setup_rename_conflict_info(RENAME_DELETE,
opt, ren1, NULL);
} else if ((dst_other.mode == ren1->pair->two->mode) &&
@@ -2923,7 +2923,7 @@ static int process_renames(struct merge_options *opt,
1, /* update_cache */
0 /* update_wd */))
clean_merge = -1;
- } else if (!oideq(&dst_other.oid, null_oid())) {
+ } else if (!oideq(&dst_other.oid, null_oid(the_hash_algo))) {
/*
* Probably not a clean merge, but it's
* premature to set clean_merge to 0 here,