git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH Cogito] cg-diff: add -s option to summarize (diffstat) changes
Date: Sun, 2 Oct 2005 12:14:20 +0200	[thread overview]
Message-ID: <20051002101419.GD9219@diku.dk> (raw)

Pipes the diff output through git-apply --stat --summary.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit 20282cdd610ecef03c8c97853bc0749ef3ab32b3
tree 6dd04a780217d116c44c1f78c5e831fc40a32df9
parent b41f8cafc556233613412ff3545e3507202b666a
author Jonas Fonseca <fonseca@diku.dk> Thu, 29 Sep 2005 15:09:42 +0200
committer Jonas Fonseca <fonseca@stud1-9.itu.dk> Thu, 29 Sep 2005 15:09:42 +0200

 cg-diff |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/cg-diff b/cg-diff
--- a/cg-diff
+++ b/cg-diff
@@ -17,6 +17,11 @@
 #	Instead of one ID denotes a parent commit to the specified ID
 #	(which must not be a tree, obviously).
 #
+# -s::
+#	Summarize the diff by showing a histogram for removed and added
+#	lines (similar to the output of diffstat(1)) and information
+#	about added and renamed files and mode changes.
+#
 # -r FROM_ID[:TO_ID]::
 #	Specify the revisions to diff using either '-r rev1:rev2' or
 #	'-r rev1 -r rev2'. If no revision is specified, the current
@@ -41,7 +46,7 @@
 #	to before invoking $PAGER. It defaults to $LESS concatenated
 #	with the `R` flag to allow displaying of colorized output.
 
-USAGE="cg-diff [-c] [-m] [-p] [-r FROM_ID[:TO_ID]] [FILE]..."
+USAGE="cg-diff [-c] [-m] [-s] [-p] [-r FROM_ID[:TO_ID]] [FILE]..."
 
 . ${COGITO_LIB}cg-Xlib || exit 1
 
@@ -65,7 +70,12 @@ setup_colors()
 
 colorize()
 {
-	if [ "$opt_color" ]; then
+	if [ "$opt_summary" ]; then
+		# Add an empty line so the diffstat indentation won't
+		# get messed up
+		echo
+		git-apply --summary --stat
+	elif [ "$opt_color" ]; then
 		gawk '
 		{ if (/^(diff --git) /)
 		    print "'$coldiffhdr'" $0 "'$coldefault'"
@@ -96,6 +106,7 @@ id2=" "
 parent=
 opt_color=
 mergebase=
+opt_summary=
 
 while optparse; do
 	if optparse -c; then
@@ -103,6 +114,8 @@ while optparse; do
 		setup_colors
 	elif optparse -p; then
 		parent=1
+	elif optparse -s; then
+		opt_summary=1
 	elif optparse -r=; then
 		if echo "$OPTARG" | fgrep -q '..'; then
 			id2=${OPTARG#*..}

-- 
Jonas Fonseca

                 reply	other threads:[~2005-10-02 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20051002101419.GD9219@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /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).