{"thread":{"id":"43606","subject":"[PATCH] git-pickaxe -C -C -C","startedAt":"2006-11-06T09:08:10Z","lastAt":"2006-11-06T09:08:10Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295893","messageId":"7vmz75djt1.fsf@assigned-by-dhcp.cox.net","threadId":"43606","inReplyTo":null,"subject":"[PATCH] git-pickaxe -C -C -C","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-06T09:08:10Z","receivedAt":"2006-11-06T09:08:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Three -C options makes the command to look for copied lines from _any_\nexisting file in the parent commit, not just changed files.\n\nThis is of course _very_ expensive.\n\nSome numbers and observations.\n\n* git-pickaxe -C revision.c\n2.22user 0.02system 0:02.24elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k\n0inputs+0outputs (0major+5263minor)pagefaults 0swaps\nnum read blob 486\n\n* git-pickaxe -C -C -C revision.c\n35.42user 0.27system 0:37.66elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k\n0inputs+0outputs (14major+115543minor)pagefaults 0swaps\nnum read blob 43277\n\nComparing the output from the above two, with this option, it\nfinds that some lines were copied from diff.c, diff-tree.c and\nmerge-cache.c; they are obvious patterns justifiably repeated.\n\n - list of parameters to a function (ll. 214-217, 247-249);\n\n - definitions of local variables (ll. 260-263);\n\n - loops over all cache entries (ll. 581-584).\n\nThis change probably falls into the category of \"I did this not\nbecause it is useful in practice but just because I could\".\n\nNevertheless, looking at the output was very interesting.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n builtin-pickaxe.c |   10 +++++++---\n 1 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-pickaxe.c b/builtin-pickaxe.c\nindex f12b2d4..619a8c6 100644\n--- a/builtin-pickaxe.c\n+++ b/builtin-pickaxe.c\n@@ -19,7 +19,7 @@\n #include <sys/time.h>\n \n static char pickaxe_usage[] =\n-\"git-pickaxe [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\\n\"\n+\"git-pickaxe [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [-C] [commit] [--] file\\n\"\n \"  -c, --compatibility Use the same output mode as git-annotate (Default: off)\\n\"\n \"  -l, --long          Show long commit SHA1 (Default: off)\\n\"\n \"  -t, --time          Show raw timestamp (Default: off)\\n\"\n@@ -48,6 +48,7 @@ static int num_commits;\n #define PICKAXE_BLAME_MOVE\t\t01\n #define PICKAXE_BLAME_COPY\t\t02\n #define PICKAXE_BLAME_COPY_HARDER\t04\n+#define PICKAXE_BLAME_COPY_HARDEST\t010\n \n /*\n  * blame for a blame_entry with score lower than these thresholds\n@@ -885,8 +886,9 @@ static int find_copy_in_parent(struct sc\n \t * and this code needs to be after diff_setup_done(), which\n \t * usually makes find-copies-harder imply copy detection.\n \t */\n-\tif ((opt & PICKAXE_BLAME_COPY_HARDER) &&\n-\t    (!porigin || strcmp(target->path, porigin->path)))\n+\tif (((opt & PICKAXE_BLAME_COPY_HARDER) &&\n+\t     (!porigin || strcmp(target->path, porigin->path))) ||\n+\t    (opt & PICKAXE_BLAME_COPY_HARDEST))\n \t\tdiff_opts.find_copies_harder = 1;\n \n \tdiff_tree_sha1(parent->tree->object.sha1,\n@@ -1569,6 +1571,8 @@ int cmd_pickaxe(int argc, const char **a\n \t\t\tblame_move_score = parse_score(arg+2);\n \t\t}\n \t\telse if (!strncmp(\"-C\", arg, 2)) {\n+\t\t\tif (opt & PICKAXE_BLAME_COPY_HARDER)\n+\t\t\t\topt |= PICKAXE_BLAME_COPY_HARDEST;\n \t\t\tif (opt & PICKAXE_BLAME_COPY)\n \t\t\t\topt |= PICKAXE_BLAME_COPY_HARDER;\n \t\t\topt |= PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE;\n-- \n1.4.3.4.g9f05\n\n"}]}