[PATCH] Redo rename/copy detection logic.
[gitweb.git] / diff-tree.c
index 0fd28f12883e7e99d73d3b35f536e8168a366c06..a7e7345bd622e1885471345c759d0fe9ae20c6d9 100644 (file)
@@ -266,21 +266,30 @@ static int call_diff_flush(void)
 {
        if (detect_rename)
                diffcore_rename(detect_rename, diff_score_opt);
-       diffcore_prune();
-       if (pickaxe) {
+       if (pickaxe)
                diffcore_pickaxe(pickaxe);
-               if (diff_queue_is_empty()) {
-                       diff_flush(DIFF_FORMAT_NO_OUTPUT);
-                       return 0;
-               }
+       if (diff_queue_is_empty()) {
+               diff_flush(DIFF_FORMAT_NO_OUTPUT, 0);
+               return 0;
        }
        if (nr_paths)
                diffcore_pathspec(paths);
        if (header) {
-               printf("%s", header);
+               if (diff_output_format == DIFF_FORMAT_MACHINE) {
+                       const char *ep, *cp;
+                       for (cp = header; *cp; cp = ep) {
+                               ep = strchr(cp, '\n');
+                               if (ep == 0) ep = cp + strlen(cp);
+                               printf("%.*s%c", ep-cp, cp, 0);
+                               if (*ep) ep++;
+                       }
+               }
+               else {
+                       printf("%s", header);
+               }
                header = NULL;
        }
-       diff_flush(diff_output_format);
+       diff_flush(diff_output_format, 1);
        return 1;
 }