summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9d8a5a5)
raw | patch | inline | side by side (parent: 9d8a5a5)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 6 Jan 2011 21:50:05 +0000 (13:50 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 22 Mar 2011 21:29:07 +0000 (14:29 -0700) |
This will allow us to later skip unmodified entries added due to "-C -C".
We might also want to do something similar to rename_dst side, but that
would only be for the sake of symmetry and not necessary for this series.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We might also want to do something similar to rename_dst side, but that
would only be for the sake of symmetry and not necessary for this series.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-rename.c | patch | blob | history |
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 00f7f8428f18153c74c0c4d7abc4977bdc3ddeda..a932f762d29df59e520a999fd82bbad605b14bd4 100644 (file)
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
/* Table of rename/copy src files */
static struct diff_rename_src {
- struct diff_filespec *one;
+ struct diff_filepair *p;
unsigned short score; /* to remember the break score */
} *rename_src;
static int rename_src_nr, rename_src_alloc;
-static struct diff_rename_src *register_rename_src(struct diff_filespec *one,
- unsigned short score)
+static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
{
int first, last;
+ struct diff_filespec *one = p->one;
+ unsigned short score = p->score;
first = 0;
last = rename_src_nr;
while (last > first) {
int next = (last + first) >> 1;
struct diff_rename_src *src = &(rename_src[next]);
- int cmp = strcmp(one->path, src->one->path);
+ int cmp = strcmp(one->path, src->p->one->path);
if (!cmp)
return src;
if (cmp < 0) {
if (first < rename_src_nr)
memmove(rename_src + first + 1, rename_src + first,
(rename_src_nr - first - 1) * sizeof(*rename_src));
- rename_src[first].one = one;
+ rename_src[first].p = p;
rename_src[first].score = score;
return &(rename_src[first]);
}
if (rename_dst[dst_index].pair)
die("internal error: dst already matched.");
- src = rename_src[src_index].one;
+ src = rename_src[src_index].p->one;
src->rename_used++;
src->count++;
init_hash(&file_table);
for (i = 0; i < rename_src_nr; i++)
- insert_file_table(&file_table, -1, i, rename_src[i].one);
+ insert_file_table(&file_table, -1, i, rename_src[i].p->one);
for (i = 0; i < rename_dst_nr; i++)
insert_file_table(&file_table, 1, i, rename_dst[i].two);
@@ -460,7 +461,7 @@ static int find_renames(struct diff_score *mx, int dst_cnt, int minimum_score, i
dst = &rename_dst[mx[i].dst];
if (dst->pair)
continue; /* already done, either exact or fuzzy. */
- if (!copies && rename_src[mx[i].src].one->rename_used)
+ if (!copies && rename_src[mx[i].src].p->one->rename_used)
continue;
record_rename_pair(mx[i].dst, mx[i].src, mx[i].score);
count++;
*/
if (p->broken_pair && !p->score)
p->one->rename_used++;
- register_rename_src(p->one, p->score);
+ register_rename_src(p);
}
else if (detect_rename == DIFF_DETECT_COPY) {
/*
* one, to indicate ourselves as a user.
*/
p->one->rename_used++;
- register_rename_src(p->one, p->score);
+ register_rename_src(p);
}
}
if (rename_dst_nr == 0 || rename_src_nr == 0)
m[j].dst = -1;
for (j = 0; j < rename_src_nr; j++) {
- struct diff_filespec *one = rename_src[j].one;
+ struct diff_filespec *one = rename_src[j].p->one;
struct diff_score this_src;
this_src.score = estimate_similarity(one, two,
minimum_score);