* [PATCH] git-pickaxe -C -C -C
@ 2006-11-06 9:08 Junio C Hamano
2006-11-06 16:46 ` Horst H. von Brand
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-11-06 9:08 UTC (permalink / raw)
To: git
Three -C options makes the command to look for copied lines from _any_
existing file in the parent commit, not just changed files.
This is of course _very_ expensive.
Some numbers and observations.
* git-pickaxe -C revision.c
2.22user 0.02system 0:02.24elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+5263minor)pagefaults 0swaps
num read blob 486
* git-pickaxe -C -C -C revision.c
35.42user 0.27system 0:37.66elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (14major+115543minor)pagefaults 0swaps
num read blob 43277
Comparing the output from the above two, with this option, it
finds that some lines were copied from diff.c, diff-tree.c and
merge-cache.c; they are obvious patterns justifiably repeated.
- list of parameters to a function (ll. 214-217, 247-249);
- definitions of local variables (ll. 260-263);
- loops over all cache entries (ll. 581-584).
This change probably falls into the category of "I did this not
because it is useful in practice but just because I could".
Nevertheless, looking at the output was very interesting.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
builtin-pickaxe.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/builtin-pickaxe.c b/builtin-pickaxe.c
index f12b2d4..619a8c6 100644
--- a/builtin-pickaxe.c
+++ b/builtin-pickaxe.c
@@ -19,7 +19,7 @@
#include <sys/time.h>
static char pickaxe_usage[] =
-"git-pickaxe [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\n"
+"git-pickaxe [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [-C] [commit] [--] file\n"
" -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
" -l, --long Show long commit SHA1 (Default: off)\n"
" -t, --time Show raw timestamp (Default: off)\n"
@@ -48,6 +48,7 @@ static int num_commits;
#define PICKAXE_BLAME_MOVE 01
#define PICKAXE_BLAME_COPY 02
#define PICKAXE_BLAME_COPY_HARDER 04
+#define PICKAXE_BLAME_COPY_HARDEST 010
/*
* blame for a blame_entry with score lower than these thresholds
@@ -885,8 +886,9 @@ static int find_copy_in_parent(struct sc
* and this code needs to be after diff_setup_done(), which
* usually makes find-copies-harder imply copy detection.
*/
- if ((opt & PICKAXE_BLAME_COPY_HARDER) &&
- (!porigin || strcmp(target->path, porigin->path)))
+ if (((opt & PICKAXE_BLAME_COPY_HARDER) &&
+ (!porigin || strcmp(target->path, porigin->path))) ||
+ (opt & PICKAXE_BLAME_COPY_HARDEST))
diff_opts.find_copies_harder = 1;
diff_tree_sha1(parent->tree->object.sha1,
@@ -1569,6 +1571,8 @@ int cmd_pickaxe(int argc, const char **a
blame_move_score = parse_score(arg+2);
}
else if (!strncmp("-C", arg, 2)) {
+ if (opt & PICKAXE_BLAME_COPY_HARDER)
+ opt |= PICKAXE_BLAME_COPY_HARDEST;
if (opt & PICKAXE_BLAME_COPY)
opt |= PICKAXE_BLAME_COPY_HARDER;
opt |= PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE;
--
1.4.3.4.g9f05
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-pickaxe -C -C -C
2006-11-06 9:08 [PATCH] git-pickaxe -C -C -C Junio C Hamano
@ 2006-11-06 16:46 ` Horst H. von Brand
2006-11-06 17:25 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Horst H. von Brand @ 2006-11-06 16:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano <junkio@cox.net> wrote:
> Three -C options makes the command to look for copied lines from _any_
> existing file in the parent commit, not just changed files.
IMHO, this is horrible UI.
-C is one thing
-C -C is another
-C -C -C is still another?
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] git-pickaxe -C -C -C
2006-11-06 16:46 ` Horst H. von Brand
@ 2006-11-06 17:25 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2006-11-06 17:25 UTC (permalink / raw)
To: Horst H. von Brand; +Cc: git
"Horst H. von Brand" <vonbrand@inf.utfsm.cl> writes:
> Junio C Hamano <junkio@cox.net> wrote:
>> Three -C options makes the command to look for copied lines from _any_
>> existing file in the parent commit, not just changed files.
>
> IMHO, this is horrible UI.
>
> -C is one thing
> -C -C is another
> -C -C -C is still another?
I think of it as "-v" vs "-v -v" vs "-v -v -v" some programs use
to give you increasing levels of verbosity.
Triple-C version is a kind of joke and not to be integrated
(although it seems to work as advertised, it is inpractically
slow), so it really is between -C vs -C -C, but certainly I am
open to better ways of specifying the current -C/-C -C options.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-06 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 9:08 [PATCH] git-pickaxe -C -C -C Junio C Hamano
2006-11-06 16:46 ` Horst H. von Brand
2006-11-06 17:25 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).