* [PATCH] guilt: add option guilt.diffstat @ 2008-12-13 2:14 Wu Fengguang 2008-12-13 4:43 ` Josef Jeff Sipek 0 siblings, 1 reply; 9+ messages in thread From: Wu Fengguang @ 2008-12-13 2:14 UTC (permalink / raw) To: Josef Jeff Sipek; +Cc: git 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> --- guilt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- guilt.orig 2008-12-13 09:53:32.000000000 +0800 +++ guilt 2008-12-13 10:01:03.000000000 +0800 @@ -538,7 +538,7 @@ __refresh_patch() [ ! -z "$4" ] && diffopts="-C -M --find-copies-harder" - if [ ! -z "$5" ]; then + if [ -n "$5" -o "x$diffstat" = "x1" ]; then ( echo "---" git diff --stat $diffopts "$2" @@ -627,6 +627,9 @@ guilt_push_diff_context=1 # default autotag value AUTOTAG_DEFAULT=1 +# default diffstat value +DIFFSTAT_DEFAULT=0 + # # Parse any part of .git/config that belongs to us # @@ -635,6 +638,10 @@ AUTOTAG_DEFAULT=1 autotag=`git config guilt.autotag` [ -z "$autotag" ] && autotag=$AUTOTAG_DEFAULT +# generate diffstat? +diffstat=`git config guilt.diffstat` +[ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT + # # The following gets run every time this file is source'd # ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] guilt: add option guilt.diffstat 2008-12-13 2:14 [PATCH] guilt: add option guilt.diffstat Wu Fengguang @ 2008-12-13 4:43 ` Josef Jeff Sipek 2008-12-13 6:18 ` Boyd Stephen Smith Jr. 2008-12-13 13:17 ` Wu Fengguang 0 siblings, 2 replies; 9+ messages in thread From: Josef Jeff Sipek @ 2008-12-13 4:43 UTC (permalink / raw) To: Wu Fengguang; +Cc: git 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. > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> > --- > guilt | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > --- guilt.orig 2008-12-13 09:53:32.000000000 +0800 > +++ guilt 2008-12-13 10:01:03.000000000 +0800 > @@ -538,7 +538,7 @@ __refresh_patch() > > [ ! -z "$4" ] && diffopts="-C -M --find-copies-harder" > > - if [ ! -z "$5" ]; then > + if [ -n "$5" -o "x$diffstat" = "x1" ]; then Why the 'x' thing? I've seen it is some scripts before, but I can't think of a reason to use it if the variable is surrounded in quotation marks. > ( > echo "---" > git diff --stat $diffopts "$2" > @@ -627,6 +627,9 @@ guilt_push_diff_context=1 > # default autotag value > AUTOTAG_DEFAULT=1 > > +# default diffstat value > +DIFFSTAT_DEFAULT=0 > + > # > # Parse any part of .git/config that belongs to us > # > @@ -635,6 +638,10 @@ AUTOTAG_DEFAULT=1 > autotag=`git config guilt.autotag` > [ -z "$autotag" ] && autotag=$AUTOTAG_DEFAULT > > +# generate diffstat? > +diffstat=`git config guilt.diffstat` > +[ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT > + > # > # The following gets run every time this file is source'd > # Could you throw a quick note into the manpages? Thanks, Josef 'Jeff' Sipek. -- My public GPG key can be found at http://www.josefsipek.net/gpg/public-0xC7958FFE.txt ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] guilt: add option guilt.diffstat 2008-12-13 4:43 ` Josef Jeff Sipek @ 2008-12-13 6:18 ` Boyd Stephen Smith Jr. 2008-12-13 6:23 ` Josef Jeff Sipek 2008-12-13 13:17 ` Wu Fengguang 1 sibling, 1 reply; 9+ messages in thread From: Boyd Stephen Smith Jr. @ 2008-12-13 6:18 UTC (permalink / raw) To: Josef Jeff Sipek; +Cc: Wu Fengguang, git [-- Attachment #1: Type: text/plain, Size: 812 bytes --] On Friday 2008 December 12 22:43:57 Josef Jeff Sipek wrote: >> + if [ -n "$5" -o "x$diffstat" = "x1" ]; then > >Why the 'x' thing? I've seen it is some scripts before, but I can't think of >a reason to use it if the variable is surrounded in quotation marks. '[' or test see the arguments after they are unquoted (normally). So, if "$diffstat" is "-n" it might try and do the -n test, rather than the = test. It could be re-written as "1" == "${diffstat}" instead to avoid the x, but it's not a big deal (to me). That also looks backwards to a lot of people. -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss03@volumehost.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.org/ \_/ [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] guilt: add option guilt.diffstat 2008-12-13 6:18 ` Boyd Stephen Smith Jr. @ 2008-12-13 6:23 ` Josef Jeff Sipek 0 siblings, 0 replies; 9+ messages in thread From: Josef Jeff Sipek @ 2008-12-13 6:23 UTC (permalink / raw) To: Boyd Stephen Smith Jr.; +Cc: Wu Fengguang, git On Sat, Dec 13, 2008 at 12:18:50AM -0600, Boyd Stephen Smith Jr. wrote: > On Friday 2008 December 12 22:43:57 Josef Jeff Sipek wrote: > >> + if [ -n "$5" -o "x$diffstat" = "x1" ]; then > > > >Why the 'x' thing? I've seen it is some scripts before, but I can't think of > >a reason to use it if the variable is surrounded in quotation marks. > > '[' or test see the arguments after they are unquoted (normally). So, > if "$diffstat" is "-n" it might try and do the -n test, rather than the = > test. Oh. I haven't even thought of that posibility! > It could be re-written as "1" == "${diffstat}" instead to avoid the x, but > it's not a big deal (to me). That also looks backwards to a lot of people. Including me. Thanks for the info. Josef 'Jeff' Sipek. -- Penguin : Linux version 2.6.25.4 on an i386 machine (6135.73 BogoMips). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] guilt: add option guilt.diffstat 2008-12-13 4:43 ` Josef Jeff Sipek 2008-12-13 6:18 ` Boyd Stephen Smith Jr. @ 2008-12-13 13:17 ` Wu Fengguang 2008-12-18 11:26 ` [PATCH][RESEND] " Wu Fengguang 1 sibling, 1 reply; 9+ messages in thread From: Wu Fengguang @ 2008-12-13 13:17 UTC (permalink / raw) To: Josef Jeff Sipek; +Cc: git@vger.kernel.org, Boyd Stephen Smith Jr. Hi Jeff, On Sat, Dec 13, 2008 at 06:43:57AM +0200, Josef Jeff Sipek wrote: > 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 # ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH][RESEND] guilt: add option guilt.diffstat 2008-12-13 13:17 ` Wu Fengguang @ 2008-12-18 11:26 ` Wu Fengguang 2008-12-18 14:39 ` Josef Jeff Sipek 2008-12-20 4:33 ` Josef Jeff Sipek 0 siblings, 2 replies; 9+ messages in thread From: Wu Fengguang @ 2008-12-18 11:26 UTC (permalink / raw) To: Josef Jeff Sipek; +Cc: git@vger.kernel.org, Boyd Stephen Smith Jr. 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> --- Jeff: This patch is against the latest guilt v0.32-rc1. Documentation/guilt-refresh.txt | 10 ++++++++-- guilt | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) --- guilt.orig/guilt +++ guilt/guilt @@ -646,7 +646,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" @@ -737,10 +737,17 @@ guilt_hook() # used for: git apply -C <val> guilt_push_diff_context=1 +# default diffstat value: true or false +DIFFSTAT_DEFAULT="false" + # # Parse any part of .git/config that belongs to us # +# generate diffstat? +diffstat=`git config --bool guilt.diffstat` +[ -z "$diffstat" ] && diffstat=$DIFFSTAT_DEFAULT + # # The following gets run every time this file is source'd # --- guilt.orig/Documentation/guilt-refresh.txt +++ guilt/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 ------ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] guilt: add option guilt.diffstat 2008-12-18 11:26 ` [PATCH][RESEND] " Wu Fengguang @ 2008-12-18 14:39 ` Josef Jeff Sipek 2008-12-19 0:08 ` Wu Fengguang 2008-12-20 4:33 ` Josef Jeff Sipek 1 sibling, 1 reply; 9+ messages in thread From: Josef Jeff Sipek @ 2008-12-18 14:39 UTC (permalink / raw) To: Wu Fengguang; +Cc: git@vger.kernel.org, Boyd Stephen Smith Jr. On Thu, Dec 18, 2008 at 07:26:43PM +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. I haven't forgotten about this. I'll try to apply it tonight/tomorrow morning. Jeff. -- Humans were created by water to transport it upward. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] guilt: add option guilt.diffstat 2008-12-18 14:39 ` Josef Jeff Sipek @ 2008-12-19 0:08 ` Wu Fengguang 0 siblings, 0 replies; 9+ messages in thread From: Wu Fengguang @ 2008-12-19 0:08 UTC (permalink / raw) To: Josef Jeff Sipek; +Cc: git@vger.kernel.org, Boyd Stephen Smith Jr. On Thu, Dec 18, 2008 at 04:39:18PM +0200, Josef Jeff Sipek wrote: > On Thu, Dec 18, 2008 at 07:26:43PM +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. > > I haven't forgotten about this. I'll try to apply it tonight/tomorrow > morning. Thank you. This refreshed patch resolved merge conflict against the latest git tree :) Thanks, Fengguang ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] guilt: add option guilt.diffstat 2008-12-18 11:26 ` [PATCH][RESEND] " Wu Fengguang 2008-12-18 14:39 ` Josef Jeff Sipek @ 2008-12-20 4:33 ` Josef Jeff Sipek 1 sibling, 0 replies; 9+ messages in thread From: Josef Jeff Sipek @ 2008-12-20 4:33 UTC (permalink / raw) To: Wu Fengguang; +Cc: git@vger.kernel.org, Boyd Stephen Smith Jr. On Thu, Dec 18, 2008 at 07:26:43PM +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. Applied. Thanks, Josef 'Jeff' Sipek. -- In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. - Linus Torvalds ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-12-20 4:35 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-12-13 2:14 [PATCH] guilt: add option guilt.diffstat Wu Fengguang 2008-12-13 4:43 ` Josef Jeff Sipek 2008-12-13 6:18 ` Boyd Stephen Smith Jr. 2008-12-13 6:23 ` Josef Jeff Sipek 2008-12-13 13:17 ` Wu Fengguang 2008-12-18 11:26 ` [PATCH][RESEND] " Wu Fengguang 2008-12-18 14:39 ` Josef Jeff Sipek 2008-12-19 0:08 ` Wu Fengguang 2008-12-20 4:33 ` Josef Jeff Sipek
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).