Do not try to detect move/copy for entries below threshold.
Splits for such entries are rejected anyway, so there is no point even trying to compute them. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexander Gavrilov committed
Jul 16, 2008 at 02:00 UTC
1617fe9879c96659107b13cc4957a855e838702d
1 file changed
+11
-5
builtin-blame.c
+11
-5
@@ -1012,7 +1012,8 @@ static int find_move_in_parent(struct scoreboard *sb,
1012
while (made_progress) {
1013
made_progress = 0;
1014
for (e = sb->ent; e; e = e->next) {
1015
- if (e->guilty || !same_suspect(e->suspect, target))
1015
+ if (e->guilty || !same_suspect(e->suspect, target) ||
1016
+ ent_score(sb, e) < blame_move_score)
1017
continue;
1018
find_copy_in_blob(sb, e, parent, split, &file_p);
1019
if (split[1].suspect &&
@@ -1037,6 +1038,7 @@ struct blame_list {
1038
*/
1039
static struct blame_list *setup_blame_list(struct scoreboard *sb,
1040
struct origin *target,
1041
+ int min_score,
1042
int *num_ents_p)
1043
{
1044
struct blame_entry *e;
@@ -1044,12 +1046,16 @@ static struct blame_list *setup_blame_list(struct scoreboard *sb,
1046
struct blame_list *blame_list = NULL;
1047
1048
for (e = sb->ent, num_ents = 0; e; e = e->next)
1047
- if (!e->scanned && !e->guilty && same_suspect(e->suspect, target))
1049
+ if (!e->scanned && !e->guilty &&
1050
+ same_suspect(e->suspect, target) &&
1051
+ min_score < ent_score(sb, e))
1052
num_ents++;
1053
if (num_ents) {
1054
blame_list = xcalloc(num_ents, sizeof(struct blame_list));
1055
for (e = sb->ent, i = 0; e; e = e->next)
1052
- if (!e->scanned && !e->guilty && same_suspect(e->suspect, target))
1056
+ if (!e->scanned && !e->guilty &&
1057
+ same_suspect(e->suspect, target) &&
1058
+ min_score < ent_score(sb, e))
1059
blame_list[i++].ent = e;
1060
}
1061
*num_ents_p = num_ents;
@@ -1084,7 +1090,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
1090
struct blame_list *blame_list;
1091
int num_ents;
1092
1087
- blame_list = setup_blame_list(sb, target, &num_ents);
1093
+ blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
1094
if (!blame_list)
1095
return 1; /* nothing remains for this target */
1096
@@ -1166,7 +1172,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
1172
1173
if (!made_progress)
1174
break;
1169
- blame_list = setup_blame_list(sb, target, &num_ents);
1175
+ blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
1176
if (!blame_list) {
1177
retval = 1;
1178
break;