{"thread":{"id":"29673","subject":"rfe: git-config: lack of color reset option","startedAt":"2012-02-20T20:50:11Z","lastAt":"2012-02-20T22:05:53Z","messageCount":3,"participants":["Jan Engelhardt","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"185022","messageId":"alpine.LNX.2.01.1202202142160.31585@frira.zrqbmnf.qr","threadId":"29673","inReplyTo":null,"subject":"rfe: git-config: lack of color reset option","fromName":"Jan Engelhardt","fromEmail":"jengelh@medozas.de","sentAt":"2012-02-20T20:50:11Z","receivedAt":"2012-02-20T20:50:11Z","isPatch":false,"sender":{"key":"jengelh@medozas.de","avatar":null},"body":"Hi,\n\n\ngiven the following config:\n\n[color \"diff\"]\n\tcommit = bold white blue\n[color \"decorate\"]\n\tbranch = green\n\nThe attributes from color.diff.commit are inherited for color.decorate.\n\n1. There seems to be no way to reset the attributes such that\n\"color.decorate.branch = default green blue\" wouuld have an effect.\n\n2. It would be nice if there was an option to only paint the \ncommit hash, rather than the entire line including the decorate \nparenthesis group.\n\n(My current version is 1.7.7, but there seem to be no changes regarding \ncolor config in 1.7.8 and 1.7.9 in the release notes, so I presume the \nissue is still current.)\n"},{"id":"185026","messageId":"20120220212006.GB6335@sigill.intra.peff.net","threadId":"29673","inReplyTo":"alpine.LNX.2.01.1202202142160.31585@frira.zrqbmnf.qr","subject":"Re: rfe: git-config: lack of color reset option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-02-20T21:20:06Z","receivedAt":"2012-02-20T21:20:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 20, 2012 at 09:50:11PM +0100, Jan Engelhardt wrote:\n\n> given the following config:\n> \n> [color \"diff\"]\n> \tcommit = bold white blue\n> [color \"decorate\"]\n> \tbranch = green\n> \n> The attributes from color.diff.commit are inherited for color.decorate.\n\nThis is an artifact of the way the ANSI colorizing works. Git says \"turn\non bold white and a blue background\", then it outputs some content, then\nit says \"turn on green\", and so forth. At the end we issue a \"reset\" to\nturn everything back to normal. We should perhaps issue a reset before\noutputting the decoration, as we are moving from one colorized bit to\nthe other, and we don't know what we are inheriting.\n\nOf course that would break people who _want_ the blue background to\ncontinue into the branch decoration. But they can easily fix it by\nputting \"green blue\" in their config.\n\n> 1. There seems to be no way to reset the attributes such that\n> \"color.decorate.branch = default green blue\" wouuld have an effect.\n\nI would have expected that perhaps setting color.decorate.branch to\n\"reset green\" would work, but it seems that we don't allow arbitrary\nsequences. Which would be another possible solution.\n\nIn your case, I think you just want turn off bold without resetting the\nwhole thing. That is its own attribute. It would be nice if we supported\n\"nobold\", \"noreverse\", etc. But you wouldn't really need them if we\nproperly reset at the transition between two colorized bits.\n\n> 2. It would be nice if there was an option to only paint the \n> commit hash, rather than the entire line including the decorate \n> parenthesis group.\n\nYeah, the parentheses are explicitly painted. I'm not sure how to easily\nfix that short of adding lots of painfully small config options.\n\nI have a long term dream that our --pretty=format specifiers would grow\nfeatureful enough that all of the other --pretty formats could be\nimplemented in terms of them. And then you could tweak to your hearts\ncontent, starting with the embedded definition of what \"git log\" shows\nand putting colors wherever you like. I'm not sure how far we are off\nfrom doing that now. You could try writing a format-specifier that looks\nlike git-log output and see if there is anything lacking.\n\n-Peff\n"},{"id":"185038","messageId":"7vwr7hjh32.fsf@alter.siamese.dyndns.org","threadId":"29673","inReplyTo":"20120220212006.GB6335@sigill.intra.peff.net","subject":"Re: rfe: git-config: lack of color reset option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-20T22:05:53Z","receivedAt":"2012-02-20T22:05:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> This is an artifact of the way the ANSI colorizing works. Git says \"turn\n> on bold white and a blue background\", then it outputs some content, then\n> it says \"turn on green\", and so forth. At the end we issue a \"reset\" to\n> turn everything back to normal. We should perhaps issue a reset before\n> outputting the decoration, as we are moving from one colorized bit to\n> the other, and we don't know what we are inheriting.\n\nYeah, I agree with the diagnosis and the proposed solution. It sounds\nboth simple and correct thing to do.\n"}]}