summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-12-11 09:08:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-14 17:34:50 (GMT)
commit26a66a6b1c653bc6c05534016992985d48267d70 (patch)
treec65ac7f1ba9da933a0f8ef346477254c380ef607 /diffcore-rename.c
parent3a0b884caba2752da0af626fb2de7d597c844e8b (diff)
downloadgit-26a66a6b1c653bc6c05534016992985d48267d70.zip
git-26a66a6b1c653bc6c05534016992985d48267d70.tar.gz
git-26a66a6b1c653bc6c05534016992985d48267d70.tar.bz2
diffcore-rename: rename num_create to num_destinations
Our main data structures are rename_src and rename_dst. For counters of these data structures, num_sources and num_destinations seem natural; definitely more so than using num_create for the latter. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index d367a6d..15a98f5 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -434,7 +434,7 @@ static void record_if_better(struct diff_score m[], struct diff_score *o)
* 1 if we need to disable inexact rename detection;
* 2 if we would be under the limit if we were given -C instead of -C -C.
*/
-static int too_many_rename_candidates(int num_create,
+static int too_many_rename_candidates(int num_destinations,
struct diff_options *options)
{
int rename_limit = options->rename_limit;
@@ -447,17 +447,17 @@ static int too_many_rename_candidates(int num_create,
* This basically does a test for the rename matrix not
* growing larger than a "rename_limit" square matrix, ie:
*
- * num_create * num_src > rename_limit * rename_limit
+ * num_destinations * num_src > rename_limit * rename_limit
*/
if (rename_limit <= 0)
rename_limit = 32767;
- if ((num_create <= rename_limit || num_src <= rename_limit) &&
- ((uint64_t)num_create * (uint64_t)num_src
+ if ((num_destinations <= rename_limit || num_src <= rename_limit) &&
+ ((uint64_t)num_destinations * (uint64_t)num_src
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
return 0;
options->needed_rename_limit =
- num_src > num_create ? num_src : num_create;
+ num_src > num_destinations ? num_src : num_destinations;
/* Are we running under -C -C? */
if (!options->flags.find_copies_harder)
@@ -469,8 +469,8 @@ static int too_many_rename_candidates(int num_create,
continue;
num_src++;
}
- if ((num_create <= rename_limit || num_src <= rename_limit) &&
- ((uint64_t)num_create * (uint64_t)num_src
+ if ((num_destinations <= rename_limit || num_src <= rename_limit) &&
+ ((uint64_t)num_destinations * (uint64_t)num_src
<= (uint64_t)rename_limit * (uint64_t)rename_limit))
return 2;
return 1;
@@ -505,7 +505,7 @@ void diffcore_rename(struct diff_options *options)
struct diff_queue_struct outq;
struct diff_score *mx;
int i, j, rename_count, skip_unmodified = 0;
- int num_create, dst_cnt;
+ int num_destinations, dst_cnt;
struct progress *progress = NULL;
if (!minimum_score)
@@ -570,13 +570,13 @@ void diffcore_rename(struct diff_options *options)
* Calculate how many renames are left (but all the source
* files still remain as options for rename/copies!)
*/
- num_create = (rename_dst_nr - rename_count);
+ num_destinations = (rename_dst_nr - rename_count);
/* All done? */
- if (!num_create)
+ if (!num_destinations)
goto cleanup;
- switch (too_many_rename_candidates(num_create, options)) {
+ switch (too_many_rename_candidates(num_destinations, options)) {
case 1:
goto cleanup;
case 2:
@@ -593,7 +593,8 @@ void diffcore_rename(struct diff_options *options)
(uint64_t)rename_dst_nr * (uint64_t)rename_src_nr);
}
- mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_create), sizeof(*mx));
+ mx = xcalloc(st_mult(NUM_CANDIDATE_PER_DST, num_destinations),
+ sizeof(*mx));
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
struct diff_filespec *two = rename_dst[i].two;
struct diff_score *m;