{"thread":{"id":"47089","subject":"Colorize matches for git log --grep=pattern?","startedAt":"2017-11-01T10:57:43Z","lastAt":"2017-11-01T19:55:00Z","messageCount":3,"participants":["Sebastian Schuberth","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"331556","messageId":"otc9a3$h9a$1@blaine.gmane.org","threadId":"47089","inReplyTo":null,"subject":"Colorize matches for git log --grep=pattern?","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-11-01T10:57:14Z","receivedAt":"2017-11-01T10:57:43Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Hi,\n\nis there a way to colorize / highlight the pattern matched by\n\n     git log -E -i --grep=pattern\n\nin the console output?\n\nRegards,\nSebastian\n\n"},{"id":"331591","messageId":"20171101185026.d4ljyywz3fepgoth@sigill.intra.peff.net","threadId":"47089","inReplyTo":"otc9a3$h9a$1@blaine.gmane.org","subject":"Re: Colorize matches for git log --grep=pattern?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-11-01T18:50:27Z","receivedAt":"2017-11-01T18:50:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Nov 01, 2017 at 11:57:14AM +0100, Sebastian Schuberth wrote:\n\n> is there a way to colorize / highlight the pattern matched by\n> \n>     git log -E -i --grep=pattern\n> \n> in the console output?\n\nI don't think so. The grep code _does_ know about colorizing matches\n(which is why \"git grep --color\" works), but for the output code path\nfor commit messages doesn't use grep at all (it couldn't, because we're\nnot just showing the relevant lines but selecting the whole commit).\n\nSo I think it would have to be reimplemented separately.\n\nThe best workaround I could come up with is passing the output through a\nhighlighting script:\n\n  git log --grep=foo --color |\n  perl -pe 's/foo/\\x1b[1;31m$&\\x1b[m/' |\n  less\n\nPretty hacky.\n\n-Peff\n"},{"id":"331597","messageId":"CAHGBnuPspJ6xsZ9dymet2Woku3PkD9fCHy2qMj7cLACCF3UXLQ@mail.gmail.com","threadId":"47089","inReplyTo":"20171101185026.d4ljyywz3fepgoth@sigill.intra.peff.net","subject":"Re: Colorize matches for git log --grep=pattern?","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2017-11-01T19:54:53Z","receivedAt":"2017-11-01T19:55:00Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Wed, Nov 1, 2017 at 7:50 PM, Jeff King <peff@peff.net> wrote:\n\n> The best workaround I could come up with is passing the output through a\n> highlighting script:\n>\n>   git log --grep=foo --color |\n>   perl -pe 's/foo/\\x1b[1;31m$&\\x1b[m/' |\n>   less\n>\n> Pretty hacky.\n\nThanks anyway. I was also considering something like this, but\nlikewise found it to be too hacky.\n\n-- \nSebastian Schuberth\n"}]}