]> granicus.if.org Git - cgit/commitdiff
ui-diff: add "stat only" diff type
authorJohn Keeping <john@keeping.me.uk>
Sun, 5 Oct 2014 09:59:05 +0000 (10:59 +0100)
committerLukas Fleischer <cgit@cryptocrack.de>
Sat, 13 Dec 2014 11:38:42 +0000 (12:38 +0100)
This prints the diffstat but stops before printing (or generating) any
of the body of the diff.

No cgitrc option is added here so that we can wait to see how useful
this is before letting people set it as the default.

Suggested-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: John Keeping <john@keeping.me.uk>
cgit.h
ui-diff.c

diff --git a/cgit.h b/cgit.h
index 0eb5ed5a4e6f10beeb4ce79519f78f08a15d2343..0c1585d34cdd4872f0ad5fc3d1cac8e01388ef02 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -53,7 +53,7 @@ typedef void (*filepair_fn)(struct diff_filepair *pair);
 typedef void (*linediff_fn)(char *line, int len);
 
 typedef enum {
-       DIFF_UNIFIED, DIFF_SSDIFF
+       DIFF_UNIFIED, DIFF_SSDIFF, DIFF_STATONLY
 } diff_type;
 
 typedef enum {
index a4ade4dd2e032c215c24355f66fb7afd159cf55f..bf2ec57d33bfd18a476d36188816714d6cfd0d31 100644 (file)
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -349,6 +349,7 @@ void cgit_print_diff_ctrls()
        curr = ctx.qry.has_difftype ? ctx.qry.difftype : ctx.cfg.difftype;
        html_intoption(0, "unified", curr);
        html_intoption(1, "ssdiff", curr);
+       html_intoption(2, "stat only", curr);
        html("</select></td></tr>");
        html("<tr><td/><td class='ctrl'>");
        html("<noscript><input type='submit' value='reload'/></noscript>");
@@ -429,6 +430,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
 
        cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix);
 
+       if (difftype == DIFF_STATONLY)
+               return;
+
        if (use_ssdiff) {
                html("<table summary='ssdiff' class='ssdiff'>");
        } else {