List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 4/4] ui-diff: add "stat only" diff type
Date: Sun,  5 Oct 2014 10:59:05 +0100	[thread overview]
Message-ID: <d092ecd33de317c3f680276d3bfad9309d268e1f.1412502867.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1412502867.git.john@keeping.me.uk>

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 at kernel.org>
Signed-off-by: John Keeping <john at keeping.me.uk>
---
 cgit.h    | 2 +-
 ui-diff.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cgit.h b/cgit.h
index 0eb5ed5..0c1585d 100644
--- 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 {
diff --git a/ui-diff.c b/ui-diff.c
index a4ade4d..bf2ec57 100644
--- 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 {
-- 
2.1.0.374.g390713e



  parent reply	other threads:[~2014-10-05  9:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05  9:59 [PATCH 0/4] Add "stat only" diff mode john
2014-10-05  9:59 ` [PATCH 1/4] ui-shared: remove toggle_ssdiff arg to cgit_commit_link() john
2014-12-24  1:48   ` Jason
2014-10-05  9:59 ` [PATCH 2/4] ui-shared: remove toggle_ssdiff arg to cgit_diff_link() john
2014-12-24  1:49   ` Jason
2014-10-05  9:59 ` [PATCH 3/4] Change "ss" diff flag to an enum john
2014-12-24  1:49   ` Jason
2014-10-05  9:59 ` john [this message]
2014-12-24  1:49   ` [PATCH 4/4] ui-diff: add "stat only" diff type Jason
2014-10-06  3:01 ` [PATCH 0/4] Add "stat only" diff mode Jason
2014-10-06  6:10   ` cgit
2014-10-06 13:25     ` mricon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d092ecd33de317c3f680276d3bfad9309d268e1f.1412502867.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).