mirror of
https://github.com/git/git
synced 2024-10-01 06:05:20 +00:00
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>
This commit is contained in:
parent
3a0b884cab
commit
26a66a6b1c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue