git-pickaxe: rename detection optimization
The idea is that we are interested in renaming into only one path, so we do not care about renames that happen elsewhere. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Nov 2, 2006 at 00:02 UTC
2f3f8b218abae6fc0574d0e22d3614fc0f5e983d
3 files changed
+7
-1
builtin-pickaxe.c
+1
@@ -289,6 +289,7 @@ static struct origin *find_rename(struct scoreboard *sb,
289
diff_opts.recursive = 1;
290
diff_opts.detect_rename = DIFF_DETECT_RENAME;
291
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
292
+ diff_opts.single_follow = origin->path;
293
paths[0] = NULL;
294
diff_tree_setup_paths(paths, &diff_opts);
295
if (diff_setup_done(&diff_opts) < 0)
diff.h
+1
@@ -46,6 +46,7 @@ struct diff_options {
46
const char *filter;
47
const char *orderfile;
48
const char *pickaxe;
49
+ const char *single_follow;
50
unsigned recursive:1,
51
tree_in_recursive:1,
52
binary:1,
diffcore-rename.c
+5
-1
@@ -256,11 +256,15 @@ void diffcore_rename(struct diff_options *options)
256
257
for (i = 0; i < q->nr; i++) {
258
struct diff_filepair *p = q->queue[i];
259
- if (!DIFF_FILE_VALID(p->one))
259
+ if (!DIFF_FILE_VALID(p->one)) {
260
if (!DIFF_FILE_VALID(p->two))
261
continue; /* unmerged */
262
+ else if (options->single_follow &&
263
+ strcmp(options->single_follow, p->two->path))
264
+ continue; /* not interested */
265
else
266
locate_rename_dst(p->two, 1);
267
+ }
268
else if (!DIFF_FILE_VALID(p->two)) {
269
/* If the source is a broken "delete", and
270
* they did not really want to get broken,