{"thread":{"id":"27191","subject":"git diff-index ignores color config","startedAt":"2011-04-26T15:04:21Z","lastAt":"2011-04-28T07:47:33Z","messageCount":9,"participants":["Elias Persson","Junio C Hamano","Michael J Gruber","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"166385","messageId":"1303830261.3387.21.camel@dhcp-141.kontor.deklomp.se","threadId":"27191","inReplyTo":null,"subject":"git diff-index ignores color config","fromName":"Elias Persson","fromEmail":"delreich@takeit.se","sentAt":"2011-04-26T15:04:21Z","receivedAt":"2011-04-26T15:04:21Z","isPatch":false,"sender":{"key":"delreich@takeit.se","avatar":null},"body":"Having color.ui (and/or color.diff) set to auto, doing\n\n   git diff-index --check <some refspec>\n\non a set with e.g. trailing whitespace does not produce colored\noutput.\n\nIf providing the option on the command line, e.g.\n\n   git diff-index --check --color=auto <some refspec>\n\noutput _is_ colored, so obviously not an issue with tty\ndetection. Doesn't work when configured to 'true' either.\n\n\nDocumentation indicates that the config option is considered\n(see under --no-color), so to me it seems like there's a bug\nhere, somewhere.\n\n\nMost likely way of coming across this issue would be turning on\nthe shipped pre-commit hook sample, at least that's how I found\nit. It ends (and does most of its work) with\n\n    exec git diff-index --check --cached $against --\n\nwhere $against is normally HEAD.\n\n\ngit --version: 1.7.4.4\nuname -srio: Linux 2.6.35.12-88.fc14.i686 i386 GNU/Linux\n\n\n// Delreich\n"},{"id":"166404","messageId":"7voc3sewpg.fsf@alter.siamese.dyndns.org","threadId":"27191","inReplyTo":"1303830261.3387.21.camel@dhcp-141.kontor.deklomp.se","subject":"Re: git diff-index ignores color config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-26T17:42:03Z","receivedAt":"2011-04-26T17:42:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elias Persson <delreich@takeit.se> writes:\n\n> Having color.ui (and/or color.diff) set to auto, doing\n>\n>    git diff-index --check <some refspec>\n>\n> on a set with e.g. trailing whitespace does not produce colored\n> output.\n\nIsn't that very much on purpose?  diff-{index,tree,files} plumbings should\nnot be affected by UI related configuration variables.\n"},{"id":"166465","messageId":"1303888846.10130.7.camel@dhcp-141.kontor.deklomp.se","threadId":"27191","inReplyTo":"7voc3sewpg.fsf@alter.siamese.dyndns.org","subject":"Re: git diff-index ignores color config","fromName":"Elias Persson","fromEmail":"delreich@takeit.se","sentAt":"2011-04-27T07:20:46Z","receivedAt":"2011-04-27T07:20:46Z","isPatch":false,"sender":{"key":"delreich@takeit.se","avatar":null},"body":"On Tue, 2011-04-26 at 10:42 -0700, Junio C Hamano wrote:\n> Isn't that very much on purpose?  diff-{index,tree,files} plumbings should\n> not be affected by UI related configuration variables.\n\nDocumentation indicates that color is configurable for it though.\nI can't say if the issue is with the behavior or the documentation.\n\nI can say I find the pre-commit verifying hook to be a lot more\nuseful when you can actually see the whitespace issues.\n"},{"id":"166466","messageId":"24a6907cade7aedb51dc20ab5977603ca21e70bb.1303889849.git.git@drmicha.warpmail.net","threadId":"27191","inReplyTo":"7voc3sewpg.fsf@alter.siamese.dyndns.org","subject":"[PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-27T07:38:27Z","receivedAt":"2011-04-27T07:38:27Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Reading the diff-family and config man pages one may think that the\ncolor.diff and color.ui settings apply to all diff commands. Make it\nclearer that they do not apply to the plumbing variants\ndiff-{files,index,tree}.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/config.txt       |    4 ++--\n Documentation/diff-options.txt |   15 +++++++++++----\n 2 files changed, 13 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 750c86d..1e22832 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -708,7 +708,7 @@ second is the background.  The position of the attribute, if any,\n doesn't matter.\n \n color.diff::\n-\tWhen set to `always`, always use colors in patch.\n+\tWhen set to `always`, always use colors in patch for porcelain commands.\n \tWhen false (or `never`), never.  When set to `true` or `auto`, use\n \tcolors only when the output is to the terminal. Defaults to false.\n \n@@ -796,7 +796,7 @@ color.status.<slot>::\n \tcolor.branch.<slot>.\n \n color.ui::\n-\tWhen set to `always`, always use colors in all git commands which\n+\tWhen set to `always`, always use colors in all porcelain commands which\n \tare capable of colored output. When false (or `never`), never. When\n \tset to `true` or `auto`, use colors only when the output is to the\n \tterminal. When more specific variables of color.* are set, they always\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex c93124b..c26e494 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -120,12 +120,19 @@ any of those replacements occurred.\n \n --color[=<when>]::\n \tShow colored diff.\n-\tThe value must be always (the default), never, or auto.\n+\tThe value must be `always` (the default for `<when>`), `never`, or `auto`.\n+\tThe default value is `never`.\n+ifdef::git-diff[]\n+\tIt can be changed by the `color.ui` and `color.diff`\n+\tconfiguration settings.\n+endif::git-diff[]\n \n --no-color::\n-\tTurn off colored diff, even when the configuration file\n-\tgives the default to color output.\n-\tSame as `--color=never`.\n+\tTurn off colored diff.\n+ifdef::git-diff[]\n+\tThis can be used to override configuration settings.\n+endif::git-diff[]\n+\tIt is the same as `--color=never`.\n \n --word-diff[=<mode>]::\n \tShow a word diff, using the <mode> to delimit changed words.\n-- \n1.7.5.270.gafca7\n"},{"id":"166485","messageId":"20110427090323.GA14849@elie","threadId":"27191","inReplyTo":"24a6907cade7aedb51dc20ab5977603ca21e70bb.1303889849.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-27T09:03:23Z","receivedAt":"2011-04-27T09:03:23Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael J Gruber wrote:\n\n> Reading the diff-family and config man pages one may think that the\n> color.diff and color.ui settings apply to all diff commands. Make it\n> clearer that they do not apply to the plumbing variants\n> diff-{files,index,tree}.\n\nSounds like a good idea.  Quick reactions:\n\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -708,7 +708,7 @@ second is the background.  The position of the attribute, if any,\n>  doesn't matter.\n>  \n>  color.diff::\n> -\tWhen set to `always`, always use colors in patch.\n> +\tWhen set to `always`, always use colors in patch for porcelain commands.\n>  \tWhen false (or `never`), never.  When set to `true` or `auto`, use\n>  \tcolors only when the output is to the terminal. Defaults to false.\n\nI am not sure I like promising that all porcelain commands will use\ncolor; for example, \"git commit -v\" does not (though \"commit -v\n--dry-run\" does).  Maybe:\n\n\tWhether to use ANSI escape sequences to add color to patches.\n\tIf this is set to `always`, linkgit:git-diff[1],\n\tlinkgit:git-log[1], and linkgit:git-show[1] will use color\n\tfor all patches.  If it is set to `true` or `auto`, those\n\tcommands will only use color when output is to the terminal.\n\tDefaults to false.\n+\nThis does not affect linkgit:git-format-patch[1] or the\n'git-diff-{asterisk}' plumbing commands.  Can be overridden on the\ncommand line with the `--color[=<when>]` option.\n\n> @@ -796,7 +796,7 @@ color.status.<slot>::\n>  \tcolor.branch.<slot>.\n>  \n>  color.ui::\n> -\tWhen set to `always`, always use colors in all git commands which\n> +\tWhen set to `always`, always use colors in all porcelain commands which\n>  \tare capable of colored output. When false (or `never`), never. When\n\nNitpick: the grammatical subject of the dependent clause (\"when set to\nalways\") and the rest of the sentence (\"always use colors\") differ, so\nthe sentence sounds awkward.  Not your fault, but while we're here, it\nmight be nice to change that.\n\nI think the intent is something like\n\n\tThis variable determines the default for color.branch,\n\tcolor.diff, color.grep, color.interactive, color.showbranch,\n\tand color.status, and its scope will expand as other commands\n\tlearn configuration to set a default for the --color option.\n\tSet it to \"always\" if you want all output not intended for\n\tmachine consumption to use color, to \"true\" or \"auto\" if you\n\twant such output to use color when written to the terminal,\n\tor to \"false\" or \"never\" if you prefer git commands not to\n\tuse color unless enabled explicitly with some other\n\tconfiguration or the --color option.\n\nIn other words, it's closer to \"all appropriate commands\" than \"all\nporcelain\".  format-patch is porcelain.  Not sure what a concise way\nto say that is, though.\n\nThanks, and hope that helps.\nJonathan\n"},{"id":"166526","messageId":"7v7hafabsj.fsf@alter.siamese.dyndns.org","threadId":"27191","inReplyTo":"20110427090323.GA14849@elie","subject":"Re: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-27T16:39:40Z","receivedAt":"2011-04-27T16:39:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Michael J Gruber wrote:\n>\n>> Reading the diff-family and config man pages one may think that the\n>> color.diff and color.ui settings apply to all diff commands. Make it\n>> clearer that they do not apply to the plumbing variants\n>> diff-{files,index,tree}.\n>\n> Sounds like a good idea.  Quick reactions:\n> ...\n> Thanks, and hope that helps.\n\nYour text reads better at least to me.\n"},{"id":"166541","messageId":"7vliyv7djb.fsf@alter.siamese.dyndns.org","threadId":"27191","inReplyTo":"7v7hafabsj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-27T18:30:16Z","receivedAt":"2011-04-27T18:30:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> Michael J Gruber wrote:\n>>\n>>> Reading the diff-family and config man pages one may think that the\n>>> color.diff and color.ui settings apply to all diff commands. Make it\n>>> clearer that they do not apply to the plumbing variants\n>>> diff-{files,index,tree}.\n>>\n>> Sounds like a good idea.  Quick reactions:\n>> ...\n>> Thanks, and hope that helps.\n>\n> Your text reads better at least to me.\n\nI'll queue the following.\n\n-- >8 --\nFrom: Michael J Gruber <git@drmicha.warpmail.net>\nSubject: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff\n\nReading the diff-family and config man pages one may think that the\ncolor.diff and color.ui settings apply to all diff commands. Make it\nclearer that they do not apply to the plumbing variants\ndiff-{files,index,tree}.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\nHelped-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/config.txt       |   27 +++++++++++++++++++--------\n Documentation/diff-options.txt |   15 +++++++++++----\n 2 files changed, 30 insertions(+), 12 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 750c86d..3967b1a 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -708,9 +708,16 @@ second is the background.  The position of the attribute, if any,\n doesn't matter.\n \n color.diff::\n-\tWhen set to `always`, always use colors in patch.\n-\tWhen false (or `never`), never.  When set to `true` or `auto`, use\n-\tcolors only when the output is to the terminal. Defaults to false.\n+\tWhether to use ANSI escape sequences to add color to patches.\n+\tIf this is set to `always`, linkgit:git-diff[1],\n+\tlinkgit:git-log[1], and linkgit:git-show[1] will use color\n+\tfor all patches.  If it is set to `true` or `auto`, those\n+\tcommands will only use color when output is to the terminal.\n+\tDefaults to false.\n++\n+This does not affect linkgit:git-format-patch[1] nor the\n+'git-diff-{asterisk}' plumbing commands.  Can be overridden on the\n+command line with the `--color[=<when>]` option.\n \n color.diff.<slot>::\n \tUse customized color for diff colorization.  `<slot>` specifies\n@@ -796,11 +803,15 @@ color.status.<slot>::\n \tcolor.branch.<slot>.\n \n color.ui::\n-\tWhen set to `always`, always use colors in all git commands which\n-\tare capable of colored output. When false (or `never`), never. When\n-\tset to `true` or `auto`, use colors only when the output is to the\n-\tterminal. When more specific variables of color.* are set, they always\n-\ttake precedence over this setting. Defaults to false.\n+\tThis variable determines the default value for variables such\n+\tas `color.diff` and `color.grep` that control the use of color\n+\tper command family. Its scope will expand as more commands learn\n+\tconfiguration to set a default for the `--color` option.  Set it\n+\tto `always` if you want all output not intended for machine\n+\tconsumption to use color, to `true` or `auto` if you want such\n+\toutput to use color when written to the terminal, or to `false` or\n+\t`never` if you prefer git commands not to use color unless enabled\n+\texplicitly with some other configuration or the `--color` option.\n \n commit.status::\n \tA boolean to enable/disable inclusion of status information in the\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex c93124b..c26e494 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -120,12 +120,19 @@ any of those replacements occurred.\n \n --color[=<when>]::\n \tShow colored diff.\n-\tThe value must be always (the default), never, or auto.\n+\tThe value must be `always` (the default for `<when>`), `never`, or `auto`.\n+\tThe default value is `never`.\n+ifdef::git-diff[]\n+\tIt can be changed by the `color.ui` and `color.diff`\n+\tconfiguration settings.\n+endif::git-diff[]\n \n --no-color::\n-\tTurn off colored diff, even when the configuration file\n-\tgives the default to color output.\n-\tSame as `--color=never`.\n+\tTurn off colored diff.\n+ifdef::git-diff[]\n+\tThis can be used to override configuration settings.\n+endif::git-diff[]\n+\tIt is the same as `--color=never`.\n \n --word-diff[=<mode>]::\n \tShow a word diff, using the <mode> to delimit changed words.\n-- \n1.7.5.208.g75460\n"},{"id":"166564","messageId":"20110427221215.GC18596@elie","threadId":"27191","inReplyTo":"7vliyv7djb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-27T22:12:15Z","receivedAt":"2011-04-27T22:12:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> I'll queue the following.\n\nThanks; looks good.\n"},{"id":"166602","messageId":"4DB91B95.2020308@drmicha.warpmail.net","threadId":"27191","inReplyTo":"20110427221215.GC18596@elie","subject":"Re: [PATCH] config.txt,diff-options.txt: porcelain vs. plumbing for color.diff","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-28T07:47:33Z","receivedAt":"2011-04-28T07:47:33Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jonathan Nieder venit, vidit, dixit 28.04.2011 00:12:\n> Junio C Hamano wrote:\n> \n>> I'll queue the following.\n> \n> Thanks; looks good.\n\nYep, thanks both of you!\n\nMichael\n"}]}