[PATCH] Optimize diff-tree -[CM] --stdin
[gitweb.git] / diff-helper.c
index 2dd6bdac33a470d3ff4f6fe63149ba33f167a4a3..6456405b53bc9ff419e1133aa4da816fe761d911 100644 (file)
@@ -4,9 +4,9 @@
 #include "cache.h"
 #include "strbuf.h"
 #include "diff.h"
-#include "diffcore.h" /* just for MAX_SCORE */
 
 static const char *pickaxe = NULL;
+static int pickaxe_opts = 0;
 static int line_termination = '\n';
 static int inter_name_termination = '\t';
 
@@ -24,6 +24,8 @@ int main(int ac, const char **av) {
                else if (av[1][1] == 'S') {
                        pickaxe = av[1] + 2;
                }
+               else if (!strcmp(av[1], "--pickaxe-all"))
+                       pickaxe_opts = DIFF_PICKAXE_ALL;
                else
                        usage(diff_helper_usage);
                ac--; av++;
@@ -78,7 +80,6 @@ int main(int ac, const char **av) {
                        if (status == 'R' || status == 'C') {
                                two_paths = 1;
                                sscanf(cp, "%d", &score);
-                               score = score * MAX_SCORE / 100;
                                if (line_termination) {
                                        cp = strchr(cp,
                                                    inter_name_termination);
@@ -128,17 +129,17 @@ int main(int ac, const char **av) {
                                          new_path);
                        continue;
                }
-               if (pickaxe)
-                       diffcore_pickaxe(pickaxe);
                if (1 < ac)
                        diffcore_pathspec(av + 1);
+               if (pickaxe)
+                       diffcore_pickaxe(pickaxe, pickaxe_opts);
                diff_flush(DIFF_FORMAT_PATCH, 0);
                printf("%s\n", sb.buf);
        }
-       if (pickaxe)
-               diffcore_pickaxe(pickaxe);
        if (1 < ac)
                diffcore_pathspec(av + 1);
+       if (pickaxe)
+               diffcore_pickaxe(pickaxe, pickaxe_opts);
        diff_flush(DIFF_FORMAT_PATCH, 0);
        return 0;
 }