git-pickaxe: re-scan the blob after making progress with -M
Otherwise we would miss copied lines that are contained in the parts before or after the part that we find after splitting the blame_entry (i.e. split[0] and split[2]). Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Nov 4, 2006 at 12:37 UTC
650e2f6752ad29b0cba394535d3b098cf4bb102b
1 file changed
+15
-9
builtin-pickaxe.c
+15
-9
@@ -766,7 +766,7 @@ static int find_move_in_parent(struct scoreboard *sb,
766
struct origin *target,
767
struct origin *parent)
768
{
769
- int last_in_target;
769
+ int last_in_target, made_progress;
770
struct blame_entry *e, split[3];
771
mmfile_t file_p;
772
char type[10];
@@ -784,14 +784,20 @@ static int find_move_in_parent(struct scoreboard *sb,
784
return 0;
785
}
786
787
- for (e = sb->ent; e; e = e->next) {
788
- if (e->guilty || cmp_suspect(e->suspect, target))
789
- continue;
790
- find_copy_in_blob(sb, e, parent, split, &file_p);
791
- if (split[1].suspect &&
792
- blame_move_score < ent_score(sb, &split[1]))
793
- split_blame(sb, split, e);
794
- decref_split(split);
787
+ made_progress = 1;
788
+ while (made_progress) {
789
+ made_progress = 0;
790
+ for (e = sb->ent; e; e = e->next) {
791
+ if (e->guilty || cmp_suspect(e->suspect, target))
792
+ continue;
793
+ find_copy_in_blob(sb, e, parent, split, &file_p);
794
+ if (split[1].suspect &&
795
+ blame_move_score < ent_score(sb, &split[1])) {
796
+ split_blame(sb, split, e);
797
+ made_progress = 1;
798
+ }
799
+ decref_split(split);
800
+ }
801
}
802
free(blob_p);
803
return 0;