Separate the raw diff and patch with a newline
[gitweb.git] / diff-tree.c
index f3280a13ee5254452da1aae93f4b6fb4a3bb8c3e..d1265d796388dd1c1a56c00f793893ee9dc6ed10 100644 (file)
@@ -52,7 +52,7 @@ static int diff_root_tree(const unsigned char *new, const char *base)
        void *tree;
        struct tree_desc empty, real;
 
-       tree = read_object_with_reference(new, "tree", &real.size, NULL);
+       tree = read_object_with_reference(new, tree_type, &real.size, NULL);
        if (!tree)
                die("unable to read root tree (%s)", sha1_to_hex(new));
        real.buf = tree;
@@ -117,8 +117,12 @@ static int diff_tree_commit(struct commit *commit)
                        return 0;
                else if (combine_merges) {
                        header = generate_header(sha1, sha1, commit);
-                       return diff_tree_combined_merge(sha1, header,
-                                                       dense_combined_merges);
+                       header = diff_tree_combined_merge(sha1, header,
+                                                       dense_combined_merges,
+                                                       &diff_options);
+                       if (!header && verbose_header)
+                               header_prefix = "\ndiff-tree ";
+                       return 0;
                }
        }
 
@@ -284,13 +288,16 @@ int main(int argc, const char **argv)
                }
                usage(diff_tree_usage);
        }
-       if (diff_options.output_format == DIFF_FORMAT_PATCH)
-               diff_options.recursive = 1;
 
-       if (combine_merges) {
-               diff_options.output_format = DIFF_FORMAT_PATCH;
+       if (combine_merges)
                ignore_merges = 0;
-       }
+
+       /* We can only do dense combined merges with diff output */
+       if (dense_combined_merges)
+               diff_options.output_format = DIFF_FORMAT_PATCH;
+
+       if (diff_options.output_format == DIFF_FORMAT_PATCH)
+               diff_options.recursive = 1;
 
        diff_tree_setup_paths(get_pathspec(prefix, argv));
        diff_setup_done(&diff_options);