about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2014-10-05 10:59:05 +0100
committerLukas Fleischer <cgit@cryptocrack.de>2014-12-13 12:38:42 +0100
commitddfaef6bb28e697491b25bff5a7b260d44ce6ccf (patch)
tree53a8bfe75e9f8250131fb2b38a346731ba5581cd
parentChange "ss" diff flag to an enum (diff)
downloadcgit-pink-ddfaef6bb28e697491b25bff5a7b260d44ce6ccf.tar.gz
cgit-pink-ddfaef6bb28e697491b25bff5a7b260d44ce6ccf.zip
ui-diff: add "stat only" diff type
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>
Diffstat (limited to '')
-rw-r--r--cgit.h2
-rw-r--r--ui-diff.c4
2 files changed, 5 insertions, 1 deletions
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 {
14:14:07 -0400'>2018-08-07Define ui.c BUF_LEN with enumJune McEnroe 2018-08-07Hack clang into checking uiFmt format stringsJune McEnroe 2018-08-07Handle PART and QUIT without messagesJune McEnroe 2018-08-07Make safe filling the who bufferJune McEnroe 2018-08-07Add reverse and reset IRC formatting codesJune McEnroe 2018-08-06Rewrite line editing again, add formattingJune McEnroe 2018-08-06Fix allocation size in vaswprintfJune McEnroe 2018-08-06Implement word wrappingJune McEnroe 2018-08-06Use wchar_t strings for all of UIJune McEnroe 2018-08-06Rename line editing functionsJune McEnroe 2018-08-05Initialize all possible color pairsJune McEnroe 2018-08-05Refactor color initializationJune McEnroe 2018-08-05Add ^L redrawJune McEnroe 2018-08-05Use 16 colors if availableJune McEnroe 2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe 2018-08-04Show source link on exitJune McEnroe 2018-08-04Implement line editing, scrollingJune McEnroe 2018-08-04Handle /topicJune McEnroe