format-patch: allow --range-diff to apply to a lone-patch
[gitweb.git] / log-tree.c
index e21c3d959fccc6266fb119edd5be459a0f3c02ce..cec983a4610649e3a8a80d70865549f48f645bea 100644 (file)
@@ -16,6 +16,7 @@
 #include "line-log.h"
 #include "help.h"
 #include "interdiff.h"
+#include "range-diff.h"
 
 static struct decoration name_decoration = { "object names" };
 static int decoration_loaded;
@@ -751,6 +752,20 @@ void show_log(struct rev_info *opt)
 
                memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
        }
+
+       if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) {
+               struct diff_queue_struct dq;
+
+               memcpy(&dq, &diff_queued_diff, sizeof(diff_queued_diff));
+               DIFF_QUEUE_CLEAR(&diff_queued_diff);
+
+               next_commentary_block(opt, NULL);
+               fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title);
+               show_range_diff(opt->rdiff1, opt->rdiff2,
+                               opt->creation_factor, 1, &opt->diffopt);
+
+               memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
+       }
 }
 
 int log_tree_diff_flush(struct rev_info *opt)