diff --git a/diffcore-rename.c b/diffcore-rename.c
index 092cf68de6455b3f2dc639d9c7a79e574ff615db..39d9126cb9d397df06d41495a3402123fa4ba46b 100644 (file)
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
return 1;
}
return 1;
}
-void diffcore_rename(int detect_rename, int minimum_score)
+void diffcore_rename(struct diff_options *options)
{
{
+ int detect_rename = options->detect_rename;
+ int minimum_score = options->rename_score;
+ int rename_limit = options->rename_limit;
struct diff_queue_struct *q = &diff_queued_diff;
struct diff_queue_struct outq;
struct diff_score *mx;
struct diff_queue_struct *q = &diff_queued_diff;
struct diff_queue_struct outq;
struct diff_score *mx;
else if (detect_rename == DIFF_DETECT_COPY)
register_rename_src(p->one, 1);
}
else if (detect_rename == DIFF_DETECT_COPY)
register_rename_src(p->one, 1);
}
- if (rename_dst_nr == 0)
+ if (rename_dst_nr == 0 || rename_src_nr == 0 ||
+ (0 < rename_limit && rename_limit < rename_dst_nr))
goto cleanup; /* nothing to do */
/* We really want to cull the candidates list early
goto cleanup; /* nothing to do */
/* We really want to cull the candidates list early
if (rename_count == rename_dst_nr)
goto cleanup;
if (rename_count == rename_dst_nr)
goto cleanup;
+ if (minimum_score == MAX_SCORE)
+ goto cleanup;
+
num_create = (rename_dst_nr - rename_count);
num_src = rename_src_nr;
mx = xmalloc(sizeof(*mx) * num_create * num_src);
num_create = (rename_dst_nr - rename_count);
num_src = rename_src_nr;
mx = xmalloc(sizeof(*mx) * num_create * num_src);