{"thread":{"id":"1997","subject":"[PATCH Cogito] cg-diff: add -s option to summarize (diffstat) changes","startedAt":"2005-10-02T10:14:20Z","lastAt":"2005-10-02T10:14:20Z","messageCount":1,"participants":["Jonas Fonseca"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9606","messageId":"20051002101419.GD9219@diku.dk","threadId":"1997","inReplyTo":null,"subject":"[PATCH Cogito] cg-diff: add -s option to summarize (diffstat) changes","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-10-02T10:14:20Z","receivedAt":"2005-10-02T10:14:20Z","isPatch":true,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Pipes the diff output through git-apply --stat --summary.\n\nSigned-off-by: Jonas Fonseca <fonseca@diku.dk>\n\n---\ncommit 20282cdd610ecef03c8c97853bc0749ef3ab32b3\ntree 6dd04a780217d116c44c1f78c5e831fc40a32df9\nparent b41f8cafc556233613412ff3545e3507202b666a\nauthor Jonas Fonseca <fonseca@diku.dk> Thu, 29 Sep 2005 15:09:42 +0200\ncommitter Jonas Fonseca <fonseca@stud1-9.itu.dk> Thu, 29 Sep 2005 15:09:42 +0200\n\n cg-diff |   17 +++++++++++++++--\n 1 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/cg-diff b/cg-diff\n--- a/cg-diff\n+++ b/cg-diff\n@@ -17,6 +17,11 @@\n #\tInstead of one ID denotes a parent commit to the specified ID\n #\t(which must not be a tree, obviously).\n #\n+# -s::\n+#\tSummarize the diff by showing a histogram for removed and added\n+#\tlines (similar to the output of diffstat(1)) and information\n+#\tabout added and renamed files and mode changes.\n+#\n # -r FROM_ID[:TO_ID]::\n #\tSpecify the revisions to diff using either '-r rev1:rev2' or\n #\t'-r rev1 -r rev2'. If no revision is specified, the current\n@@ -41,7 +46,7 @@\n #\tto before invoking $PAGER. It defaults to $LESS concatenated\n #\twith the `R` flag to allow displaying of colorized output.\n \n-USAGE=\"cg-diff [-c] [-m] [-p] [-r FROM_ID[:TO_ID]] [FILE]...\"\n+USAGE=\"cg-diff [-c] [-m] [-s] [-p] [-r FROM_ID[:TO_ID]] [FILE]...\"\n \n . ${COGITO_LIB}cg-Xlib || exit 1\n \n@@ -65,7 +70,12 @@ setup_colors()\n \n colorize()\n {\n-\tif [ \"$opt_color\" ]; then\n+\tif [ \"$opt_summary\" ]; then\n+\t\t# Add an empty line so the diffstat indentation won't\n+\t\t# get messed up\n+\t\techo\n+\t\tgit-apply --summary --stat\n+\telif [ \"$opt_color\" ]; then\n \t\tgawk '\n \t\t{ if (/^(diff --git) /)\n \t\t    print \"'$coldiffhdr'\" $0 \"'$coldefault'\"\n@@ -96,6 +106,7 @@ id2=\" \"\n parent=\n opt_color=\n mergebase=\n+opt_summary=\n \n while optparse; do\n \tif optparse -c; then\n@@ -103,6 +114,8 @@ while optparse; do\n \t\tsetup_colors\n \telif optparse -p; then\n \t\tparent=1\n+\telif optparse -s; then\n+\t\topt_summary=1\n \telif optparse -r=; then\n \t\tif echo \"$OPTARG\" | fgrep -q '..'; then\n \t\t\tid2=${OPTARG#*..}\n\n-- \nJonas Fonseca\n"}]}