summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index f7444c86bd..12dc2a056f 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -60,7 +60,7 @@ static int add_rename_dst(struct diff_filespec *two)
memmove(rename_dst + first + 1, rename_dst + first,
(rename_dst_nr - first - 1) * sizeof(*rename_dst));
rename_dst[first].two = alloc_filespec(two->path);
- fill_filespec(rename_dst[first].two, two->oid.hash, two->oid_valid,
+ fill_filespec(rename_dst[first].two, &two->oid, two->oid_valid,
two->mode);
rename_dst[first].pair = NULL;
return 0;
@@ -341,7 +341,7 @@ static int find_exact_renames(struct diff_options *options)
/* Add all sources to the hash table in reverse order, because
* later on they will be retrieved in LIFO order.
*/
- hashmap_init(&file_table, NULL, rename_src_nr);
+ hashmap_init(&file_table, NULL, NULL, rename_src_nr);
for (i = rename_src_nr-1; i >= 0; i--)
insert_file_table(&file_table, i, rename_src[i].p->one);
@@ -405,7 +405,7 @@ static int too_many_rename_candidates(int num_create,
num_src > num_create ? num_src : num_create;
/* Are we running under -C -C? */
- if (!DIFF_OPT_TST(options, FIND_COPIES_HARDER))
+ if (!options->flags.find_copies_harder)
return 1;
/* Would we bust the limit if we were running under -C? */
@@ -463,8 +463,8 @@ void diffcore_rename(struct diff_options *options)
else if (options->single_follow &&
strcmp(options->single_follow, p->two->path))
continue; /* not interested */
- else if (!DIFF_OPT_TST(options, RENAME_EMPTY) &&
- is_empty_blob_sha1(p->two->oid.hash))
+ else if (!options->flags.rename_empty &&
+ is_empty_blob_oid(&p->two->oid))
continue;
else if (add_rename_dst(p->two) < 0) {
warning("skipping rename detection, detected"
@@ -473,8 +473,8 @@ void diffcore_rename(struct diff_options *options)
goto cleanup;
}
}
- else if (!DIFF_OPT_TST(options, RENAME_EMPTY) &&
- is_empty_blob_sha1(p->one->oid.hash))
+ else if (!options->flags.rename_empty &&
+ is_empty_blob_oid(&p->one->oid))
continue;
else if (!DIFF_PAIR_UNMERGED(p) && !DIFF_FILE_VALID(p->two)) {
/*
@@ -532,9 +532,9 @@ void diffcore_rename(struct diff_options *options)
}
if (options->show_rename_progress) {
- progress = start_progress_delay(
+ progress = start_delayed_progress(
_("Performing inexact rename detection"),
- rename_dst_nr * rename_src_nr, 50, 1);
+ rename_dst_nr * rename_src_nr);
}
mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));
@@ -667,11 +667,9 @@ void diffcore_rename(struct diff_options *options)
for (i = 0; i < rename_dst_nr; i++)
free_filespec(rename_dst[i].two);
- free(rename_dst);
- rename_dst = NULL;
+ FREE_AND_NULL(rename_dst);
rename_dst_nr = rename_dst_alloc = 0;
- free(rename_src);
- rename_src = NULL;
+ FREE_AND_NULL(rename_src);
rename_src_nr = rename_src_alloc = 0;
return;
}