diff options
author | Junio C Hamano <junkio@cox.net> | 2005-05-23 18:14:03 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-23 19:17:06 -0700 |
commit | bceafe752c03f4b13b9b1671a55d9e2acd26432d (patch) | |
tree | 9036674db3bab78474a79b0445a8d8e178dc9151 /diffcore-rename.c | |
parent | 9a4a100eb46a769d1c5fa80c2daeb0b48a592d8d (diff) | |
download | git-bceafe752c03f4b13b9b1671a55d9e2acd26432d.tar.gz |
[PATCH] Fix diff-pruning logic which was running prune too early.
For later stages to reorder patches, pruning logic and rename detection
logic should not decide which delete to discard (because another entry
said it will take over the file as a rename) until the very end.
Also fix some tests that were assuming the earlier "last one is rename
or keep everything else is copy" semantics of diff-raw format, which no
longer is true.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r-- | diffcore-rename.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c index e8de493586..f40ab78bd1 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -133,10 +133,7 @@ static void record_rename_pair(struct diff_queue_struct *outq, * The downstream diffcore transformers are free to reorder * the entries as long as they keep file pairs that has the * same p->one->path in earlier rename_rank to appear before - * later ones. This ordering is used by the diff_flush() - * logic to tell renames from copies, and also used by the - * diffcore_prune() logic to omit unnecessary - * "no-modification" entries. + * later ones. * * To the final output routine, and in the diff-raw format * output, a rename/copy that is based on a path that has a @@ -271,14 +268,8 @@ void diffcore_rename(int detect_rename, int minimum_score) /* We really want to cull the candidates list early * with cheap tests in order to avoid doing deltas. - * - * With the current callers, we should not have already - * matched entries at this point, but it is nonetheless - * checked for sanity. */ for (i = 0; i < created.nr; i++) { - if (created.s[i]->xfrm_flags & RENAME_DST_MATCHED) - continue; /* we have matched exactly already */ for (h = 0; h < sizeof(srcs)/sizeof(srcs[0]); h++) { struct diff_rename_pool *p = srcs[h]; for (j = 0; j < p->nr; j++) { @@ -386,25 +377,13 @@ void diffcore_rename(int detect_rename, int minimum_score) } else if (!DIFF_FILE_VALID(p->two)) { /* deleted */ - if (p->one->xfrm_flags & RENAME_SRC_GONE) - ; /* rename/copy deleted it already */ - else - diff_queue(q, p->one, p->two); + diff_queue(q, p->one, p->two); } else if (strcmp(p->one->path, p->two->path)) { /* rename or copy */ struct diff_filepair *dp = diff_queue(q, p->one, p->two); dp->score = p->score; - - /* if we have a later entry that is a rename/copy - * that depends on p->one, then we copy here. - * otherwise we rename it. - */ - if (!diff_needs_to_stay(&outq, i+1, p->one)) - /* this is the last one, so mark it as gone. - */ - p->one->xfrm_flags |= RENAME_SRC_GONE; } else /* otherwise it is a modified (or "stay") entry */ |