git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] guilt: add option guilt.diffstat

From
WFWu Fengguang <fengguang.wu@intel.com>
Date
Dec 13, 2008, 13:17 UTC
Message-ID
<20081213131700.GA8649@localhost>
In-Reply-To
<20081213044357.GD15407@josefsipek.net>
Hi Jeff,
On Sat, Dec 13, 2008 at 06:43:57AM +0200, Josef Jeff Sipek wrote:
Show 5 quoted lines
> On Sat, Dec 13, 2008 at 10:14:22AM +0800, Wu Fengguang wrote:
> > Introduce option guilt.diffstat so that we don't have to type
> > "guilt refresh --diffstat" in its full form every time.
> 
> Good idea.
Thanks.
> Could you throw a quick note into the manpages?

Sure. Here is the updated patch. This time I used "git-config --bool" to ensure diffstat will be either "true" or "false":

        The type specifier can be either --int or --bool, which will
        make git-config ensure that the variable(s) are of the given
        type and convert the value to the canonical form (simple
        decimal number for int, a "true" or "false" string for bool).
        If no type specifier is passed, no checks or transformations
        are performed on the value.

Thanks, Fengguang --- guilt: add option guilt.diffstat

Introduce option guilt.diffstat so that we don't have to type "guilt refresh --diffstat" in its full form every time.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
diff --git a/Documentation/guilt-refresh.txt b/Documentation/guilt-refresh.txt
index 9a0b4e8..7757bdc 100644
--- a/Documentation/guilt-refresh.txt
+++ b/Documentation/guilt-refresh.txt
@@ -20,8 +20,14 @@ OPTIONS
 	format (e.g., rename and copy detection).
 
 --diffstat::
-	Include a diffstat output in the patch file. Useful for cases where
-	patches will be submitted with other tools.
+Include a diffstat output in the patch file. Useful for cases where
+patches will be submitted with other tools.
++
+If the command line option is omitted, the corresponding git-config
+option "guilt.diffstat" will be queried. So this would enable diffstat
+output by default:
+
+	git config --global guilt.diffstat true
 
 Author
 ------
diff --git a/guilt b/guilt
index fabee17..12361da 100755
--- a/guilt
+++ b/guilt
@@ -544,7 +544,7 @@ __refresh_patch()
 
 		[ ! -z "$4" ] && diffopts="-C -M --find-copies-harder"
 		
-		if [ ! -z "$5" ]; then
+		if [ -n "$5" -o $diffstat = "true" ]; then
 			(
 				echo "---"
 				git diff --stat $diffopts "$2"
@@ -633,6 +633,9 @@ guilt_push_diff_context=1
 # default autotag value
 AUTOTAG_DEFAULT=1
 
+# default diffstat value: true or false
+DIFFSTAT_DEFAULT="false"
+
 #
 # Parse any part of .git/config that belongs to us
 #
@@ -641,6 +644,10 @@ AUTOTAG_DEFAULT=1
 autotag=`git config guilt.autotag`
 [ -z "$autotag" ] && autotag=$AUTOTAG_DEFAULT
 
+# generate diffstat?
+diffstat=`git config --bool guilt.diffstat`
+[ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT
+
 #
 # The following gets run every time this file is source'd
 #
Previous: Josef Jeff SipekNext: Wu Fengguang
Message 5 of 9 in “guilt: add option guilt.diffstat”
  1. guilt: add option guilt.diffstatWu Fengguang, Dec 13, 2008
  2. Josef Jeff SipekDec 13, 2008
  3. Boyd Stephen Smith Jr.Dec 13, 2008
  4. Josef Jeff SipekDec 13, 2008
  5. Wu FengguangDec 13, 2008
  6. [RESEND] guilt: add option guilt.diffstatWu Fengguang, Dec 18, 2008
  7. Josef Jeff SipekDec 18, 2008
  8. Wu FengguangDec 19, 2008
  9. Josef Jeff SipekDec 20, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.