{"thread":{"id":"16708","subject":"[PATCH] guilt: add option guilt.diffstat","startedAt":"2008-12-13T02:14:22Z","lastAt":"2008-12-20T04:33:38Z","messageCount":9,"participants":["Wu Fengguang","Josef Jeff Sipek","Boyd Stephen Smith Jr."],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"97774","messageId":"20081213021422.GA28249@localhost","threadId":"16708","inReplyTo":null,"subject":"[PATCH] guilt: add option guilt.diffstat","fromName":"Wu Fengguang","fromEmail":"fengguang.wu@intel.com","sentAt":"2008-12-13T02:14:22Z","receivedAt":"2008-12-13T02:14:22Z","isPatch":true,"sender":{"key":"fengguang.wu@intel.com","avatar":null},"body":"Introduce option guilt.diffstat so that we don't have to type\n\"guilt refresh --diffstat\" in its full form every time.\n\nSigned-off-by: Wu Fengguang <fengguang.wu@intel.com>\n---\n guilt |    9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\n--- guilt.orig\t2008-12-13 09:53:32.000000000 +0800\n+++ guilt\t2008-12-13 10:01:03.000000000 +0800\n@@ -538,7 +538,7 @@ __refresh_patch()\n \n \t\t[ ! -z \"$4\" ] && diffopts=\"-C -M --find-copies-harder\"\n \t\t\n-\t\tif [ ! -z \"$5\" ]; then\n+\t\tif [ -n \"$5\" -o \"x$diffstat\" = \"x1\" ]; then\n \t\t\t(\n \t\t\t\techo \"---\"\n \t\t\t\tgit diff --stat $diffopts \"$2\"\n@@ -627,6 +627,9 @@ guilt_push_diff_context=1\n # default autotag value\n AUTOTAG_DEFAULT=1\n \n+# default diffstat value\n+DIFFSTAT_DEFAULT=0\n+\n #\n # Parse any part of .git/config that belongs to us\n #\n@@ -635,6 +638,10 @@ AUTOTAG_DEFAULT=1\n autotag=`git config guilt.autotag`\n [ -z \"$autotag\" ] && autotag=$AUTOTAG_DEFAULT\n \n+# generate diffstat?\n+diffstat=`git config guilt.diffstat`\n+[ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n+\n #\n # The following gets run every time this file is source'd\n #\n"},{"id":"97780","messageId":"20081213044357.GD15407@josefsipek.net","threadId":"16708","inReplyTo":"20081213021422.GA28249@localhost","subject":"Re: [PATCH] guilt: add option guilt.diffstat","fromName":"Josef Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2008-12-13T04:43:57Z","receivedAt":"2008-12-13T04:43:57Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Sat, Dec 13, 2008 at 10:14:22AM +0800, Wu Fengguang wrote:\n> Introduce option guilt.diffstat so that we don't have to type\n> \"guilt refresh --diffstat\" in its full form every time.\n\nGood idea.\n\n> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>\n> ---\n>  guilt |    9 ++++++++-\n>  1 file changed, 8 insertions(+), 1 deletion(-)\n> \n> --- guilt.orig\t2008-12-13 09:53:32.000000000 +0800\n> +++ guilt\t2008-12-13 10:01:03.000000000 +0800\n> @@ -538,7 +538,7 @@ __refresh_patch()\n>  \n>  \t\t[ ! -z \"$4\" ] && diffopts=\"-C -M --find-copies-harder\"\n>  \t\t\n> -\t\tif [ ! -z \"$5\" ]; then\n> +\t\tif [ -n \"$5\" -o \"x$diffstat\" = \"x1\" ]; then\n\nWhy the 'x' thing? I've seen it is some scripts before, but I can't think of\na reason to use it if the variable is surrounded in quotation marks.\n\n>  \t\t\t(\n>  \t\t\t\techo \"---\"\n>  \t\t\t\tgit diff --stat $diffopts \"$2\"\n> @@ -627,6 +627,9 @@ guilt_push_diff_context=1\n>  # default autotag value\n>  AUTOTAG_DEFAULT=1\n>  \n> +# default diffstat value\n> +DIFFSTAT_DEFAULT=0\n> +\n>  #\n>  # Parse any part of .git/config that belongs to us\n>  #\n> @@ -635,6 +638,10 @@ AUTOTAG_DEFAULT=1\n>  autotag=`git config guilt.autotag`\n>  [ -z \"$autotag\" ] && autotag=$AUTOTAG_DEFAULT\n>  \n> +# generate diffstat?\n> +diffstat=`git config guilt.diffstat`\n> +[ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n> +\n>  #\n>  # The following gets run every time this file is source'd\n>  #\n\nCould you throw a quick note into the manpages?\n\nThanks,\n\nJosef 'Jeff' Sipek.\n\n-- \nMy public GPG key can be found at\nhttp://www.josefsipek.net/gpg/public-0xC7958FFE.txt\n"},{"id":"97784","messageId":"200812130018.56061.bss03@volumehost.net","threadId":"16708","inReplyTo":"20081213044357.GD15407@josefsipek.net","subject":"Re: [PATCH] guilt: add option guilt.diffstat","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss03@volumehost.net","sentAt":"2008-12-13T06:18:50Z","receivedAt":"2008-12-13T06:18:50Z","isPatch":true,"sender":{"key":"bss03@volumehost.net","avatar":"https://gravatar.com/avatar/74fa10b37dfd44462a6a30c4d4e3bda26ab7991ddb0d8ab24b022714a8ecb918?d=mp&s=160"},"body":"On Friday 2008 December 12 22:43:57 Josef Jeff Sipek wrote:\n>> +\t\tif [ -n \"$5\" -o \"x$diffstat\" = \"x1\" ]; then\n>\n>Why the 'x' thing? I've seen it is some scripts before, but I can't think of\n>a reason to use it if the variable is surrounded in quotation marks.\n\n'[' or test see the arguments after they are unquoted (normally).  So, \nif \"$diffstat\" is \"-n\" it might try and do the -n test, rather than the = \ntest.\n\nIt could be re-written as \"1\" == \"${diffstat}\" instead to avoid the x, but \nit's not a big deal (to me).  That also looks backwards to a lot of people.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss03@volumehost.net                      ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.org/                      \\_/     \n"},{"id":"97785","messageId":"20081213062313.GE15407@josefsipek.net","threadId":"16708","inReplyTo":"200812130018.56061.bss03@volumehost.net","subject":"Re: [PATCH] guilt: add option guilt.diffstat","fromName":"Josef Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2008-12-13T06:23:13Z","receivedAt":"2008-12-13T06:23:13Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Sat, Dec 13, 2008 at 12:18:50AM -0600, Boyd Stephen Smith Jr. wrote:\n> On Friday 2008 December 12 22:43:57 Josef Jeff Sipek wrote:\n> >> +\t\tif [ -n \"$5\" -o \"x$diffstat\" = \"x1\" ]; then\n> >\n> >Why the 'x' thing? I've seen it is some scripts before, but I can't think of\n> >a reason to use it if the variable is surrounded in quotation marks.\n> \n> '[' or test see the arguments after they are unquoted (normally).  So, \n> if \"$diffstat\" is \"-n\" it might try and do the -n test, rather than the = \n> test.\n\nOh. I haven't even thought of that posibility!\n\n> It could be re-written as \"1\" == \"${diffstat}\" instead to avoid the x, but \n> it's not a big deal (to me).  That also looks backwards to a lot of people.\n\nIncluding me.\n\nThanks for the info.\n\nJosef 'Jeff' Sipek.\n\n-- \nPenguin : Linux version 2.6.25.4 on an i386 machine (6135.73 BogoMips).\n"},{"id":"97792","messageId":"20081213131700.GA8649@localhost","threadId":"16708","inReplyTo":"20081213044357.GD15407@josefsipek.net","subject":"Re: [PATCH] guilt: add option guilt.diffstat","fromName":"Wu Fengguang","fromEmail":"fengguang.wu@intel.com","sentAt":"2008-12-13T13:17:00Z","receivedAt":"2008-12-13T13:17:00Z","isPatch":true,"sender":{"key":"fengguang.wu@intel.com","avatar":null},"body":"Hi Jeff,\n\nOn Sat, Dec 13, 2008 at 06:43:57AM +0200, Josef Jeff Sipek wrote:\n> On Sat, Dec 13, 2008 at 10:14:22AM +0800, Wu Fengguang wrote:\n> > Introduce option guilt.diffstat so that we don't have to type\n> > \"guilt refresh --diffstat\" in its full form every time.\n> \n> Good idea.\n\nThanks.\n\n> Could you throw a quick note into the manpages?\n\nSure. Here is the updated patch.  This time I used \"git-config --bool\"\nto ensure diffstat will be either \"true\" or \"false\":\n\n        The type specifier can be either --int or --bool, which will\n        make git-config ensure that the variable(s) are of the given\n        type and convert the value to the canonical form (simple\n        decimal number for int, a \"true\" or \"false\" string for bool).\n        If no type specifier is passed, no checks or transformations\n        are performed on the value.\n\nThanks,\nFengguang\n---\nguilt: add option guilt.diffstat\n\nIntroduce option guilt.diffstat so that we don't have to type\n\"guilt refresh --diffstat\" in its full form every time.\n\nSigned-off-by: Wu Fengguang <fengguang.wu@intel.com>\n---\ndiff --git a/Documentation/guilt-refresh.txt b/Documentation/guilt-refresh.txt\nindex 9a0b4e8..7757bdc 100644\n--- a/Documentation/guilt-refresh.txt\n+++ b/Documentation/guilt-refresh.txt\n@@ -20,8 +20,14 @@ OPTIONS\n \tformat (e.g., rename and copy detection).\n \n --diffstat::\n-\tInclude a diffstat output in the patch file. Useful for cases where\n-\tpatches will be submitted with other tools.\n+Include a diffstat output in the patch file. Useful for cases where\n+patches will be submitted with other tools.\n++\n+If the command line option is omitted, the corresponding git-config\n+option \"guilt.diffstat\" will be queried. So this would enable diffstat\n+output by default:\n+\n+\tgit config --global guilt.diffstat true\n \n Author\n ------\ndiff --git a/guilt b/guilt\nindex fabee17..12361da 100755\n--- a/guilt\n+++ b/guilt\n@@ -544,7 +544,7 @@ __refresh_patch()\n \n \t\t[ ! -z \"$4\" ] && diffopts=\"-C -M --find-copies-harder\"\n \t\t\n-\t\tif [ ! -z \"$5\" ]; then\n+\t\tif [ -n \"$5\" -o $diffstat = \"true\" ]; then\n \t\t\t(\n \t\t\t\techo \"---\"\n \t\t\t\tgit diff --stat $diffopts \"$2\"\n@@ -633,6 +633,9 @@ guilt_push_diff_context=1\n # default autotag value\n AUTOTAG_DEFAULT=1\n \n+# default diffstat value: true or false\n+DIFFSTAT_DEFAULT=\"false\"\n+\n #\n # Parse any part of .git/config that belongs to us\n #\n@@ -641,6 +644,10 @@ AUTOTAG_DEFAULT=1\n autotag=`git config guilt.autotag`\n [ -z \"$autotag\" ] && autotag=$AUTOTAG_DEFAULT\n \n+# generate diffstat?\n+diffstat=`git config --bool guilt.diffstat`\n+[ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n+\n #\n # The following gets run every time this file is source'd\n #\n"},{"id":"98245","messageId":"20081218112643.GA15416@localhost","threadId":"16708","inReplyTo":"20081213131700.GA8649@localhost","subject":"[PATCH][RESEND] guilt: add option guilt.diffstat","fromName":"Wu Fengguang","fromEmail":"fengguang.wu@intel.com","sentAt":"2008-12-18T11:26:43Z","receivedAt":"2008-12-18T11:26:43Z","isPatch":true,"sender":{"key":"fengguang.wu@intel.com","avatar":null},"body":"Introduce option guilt.diffstat so that we don't have to type\n\"guilt refresh --diffstat\" in its full form every time.\n\nSigned-off-by: Wu Fengguang <fengguang.wu@intel.com>\n---\n\nJeff: This patch is against the latest guilt v0.32-rc1.\n\n Documentation/guilt-refresh.txt |   10 ++++++++--\n guilt                           |    9 ++++++++-\n 2 files changed, 16 insertions(+), 3 deletions(-)\n\n--- guilt.orig/guilt\n+++ guilt/guilt\n@@ -646,7 +646,7 @@ __refresh_patch()\n \n \t\t[ ! -z \"$4\" ] && diffopts=\"-C -M --find-copies-harder\"\n \t\t\n-\t\tif [ ! -z \"$5\" ]; then\n+\t\tif [ -n \"$5\" -o $diffstat = \"true\" ]; then\n \t\t\t(\n \t\t\t\techo \"---\"\n \t\t\t\tgit diff --stat $diffopts \"$2\"\n@@ -737,10 +737,17 @@ guilt_hook()\n # used for: git apply -C <val>\n guilt_push_diff_context=1\n \n+# default diffstat value: true or false\n+DIFFSTAT_DEFAULT=\"false\"\n+\n #\n # Parse any part of .git/config that belongs to us\n #\n \n+# generate diffstat?\n+diffstat=`git config --bool guilt.diffstat`\n+[ -z \"$diffstat\" ] && diffstat=$DIFFSTAT_DEFAULT\n+\n #\n # The following gets run every time this file is source'd\n #\n--- guilt.orig/Documentation/guilt-refresh.txt\n+++ guilt/Documentation/guilt-refresh.txt\n@@ -20,8 +20,14 @@ OPTIONS\n \tformat (e.g., rename and copy detection).\n \n --diffstat::\n-\tInclude a diffstat output in the patch file. Useful for cases where\n-\tpatches will be submitted with other tools.\n+Include a diffstat output in the patch file. Useful for cases where\n+patches will be submitted with other tools.\n++\n+If the command line option is omitted, the corresponding git-config\n+option \"guilt.diffstat\" will be queried. So this would enable diffstat\n+output by default:\n+\n+\tgit config --global guilt.diffstat true\n \n Author\n ------\n"},{"id":"98258","messageId":"20081218143918.GM15407@josefsipek.net","threadId":"16708","inReplyTo":"20081218112643.GA15416@localhost","subject":"Re: [PATCH][RESEND] guilt: add option guilt.diffstat","fromName":"Josef Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2008-12-18T14:39:18Z","receivedAt":"2008-12-18T14:39:18Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Thu, Dec 18, 2008 at 07:26:43PM +0800, Wu Fengguang wrote:\n> Introduce option guilt.diffstat so that we don't have to type\n> \"guilt refresh --diffstat\" in its full form every time.\n\nI haven't forgotten about this. I'll try to apply it tonight/tomorrow\nmorning.\n\nJeff.\n\n-- \nHumans were created by water to transport it upward.\n"},{"id":"98304","messageId":"20081219000824.GA5562@localhost","threadId":"16708","inReplyTo":"20081218143918.GM15407@josefsipek.net","subject":"Re: [PATCH][RESEND] guilt: add option guilt.diffstat","fromName":"Wu Fengguang","fromEmail":"fengguang.wu@intel.com","sentAt":"2008-12-19T00:08:24Z","receivedAt":"2008-12-19T00:08:24Z","isPatch":true,"sender":{"key":"fengguang.wu@intel.com","avatar":null},"body":"On Thu, Dec 18, 2008 at 04:39:18PM +0200, Josef Jeff Sipek wrote:\n> On Thu, Dec 18, 2008 at 07:26:43PM +0800, Wu Fengguang wrote:\n> > Introduce option guilt.diffstat so that we don't have to type\n> > \"guilt refresh --diffstat\" in its full form every time.\n> \n> I haven't forgotten about this. I'll try to apply it tonight/tomorrow\n> morning.\n\nThank you. This refreshed patch resolved merge conflict against the\nlatest git tree :)\n\nThanks,\nFengguang\n"},{"id":"98410","messageId":"20081220043338.GS15407@josefsipek.net","threadId":"16708","inReplyTo":"20081218112643.GA15416@localhost","subject":"Re: [PATCH][RESEND] guilt: add option guilt.diffstat","fromName":"Josef Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2008-12-20T04:33:38Z","receivedAt":"2008-12-20T04:33:38Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Thu, Dec 18, 2008 at 07:26:43PM +0800, Wu Fengguang wrote:\n> Introduce option guilt.diffstat so that we don't have to type\n> \"guilt refresh --diffstat\" in its full form every time.\n\nApplied.\n\nThanks,\n\nJosef 'Jeff' Sipek.\n\n-- \nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like\nthat.\n\t\t- Linus Torvalds\n"}]}