{"thread":{"id":"33968","subject":"Has anyone tried to implement git grep --blame?","startedAt":"2013-05-29T05:41:52Z","lastAt":"2013-05-30T10:12:29Z","messageCount":2,"participants":["Ævar Arnfjörð Bjarmason","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"218753","messageId":"CACBZZX5R=zaNBv4OGh30dxj+BAi26jDxDBO5pZTQ2QxGUB6WXw@mail.gmail.com","threadId":"33968","inReplyTo":null,"subject":"Has anyone tried to implement git grep --blame?","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2013-05-29T05:41:52Z","receivedAt":"2013-05-29T05:41:52Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This would be so much more convenient if git-grep supported it natively:\n\n$ git grep -n 'if \\(0\\)' | perl -pe's/([^:]+):([^:]+).*/`git blame -L\n$2,$2 $1`/se'\nd18f76dc (Ævar Arnfjörð Bjarmason 2010-08-17 09:24:38 +0000 2278)   if (0)\n65648283 (David Brown 2007-12-25 19:56:29 -0800 433) if (0) {\n\nI.e. with all the coloring/pager interaction. Some Googling around\nreveals people piping things to git-blame like that, but has anyone\nmade a stab at a smarter implementation (that would know to blame the\nwhole file if it had lots of hits etc..).\n\nDon't know if I have time myself, but I'd be very pleased if someone\nhacked that up.\n"},{"id":"218962","messageId":"loom.20130530T121036-210@post.gmane.org","threadId":"33968","inReplyTo":"CACBZZX5R=zaNBv4OGh30dxj+BAi26jDxDBO5pZTQ2QxGUB6WXw@mail.gmail.com","subject":"Re: Has anyone tried to implement git grep --blame?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2013-05-30T10:12:29Z","receivedAt":"2013-05-30T10:12:29Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab <at> gmail.com> writes:\n\n> This would be so much more convenient if git-grep supported it natively:\n> \n> $ git grep -n 'if \\(0\\)' | perl -pe's/([^:]+):([^:]+).*/`git blame -L\n> $2,$2 $1`/se'\n> d18f76dc (Ævar Arnfjörð Bjarmason 2010-08-17 09:24:38 +0000 2278)   if (0)\n> 65648283 (David Brown 2007-12-25 19:56:29 -0800 433) if (0) {\n> \n> I.e. with all the coloring/pager interaction. Some Googling around\n> reveals people piping things to git-blame like that, but has anyone\n> made a stab at a smarter implementation (that would know to blame the\n> whole file if it had lots of hits etc..).\n> \n> Don't know if I have time myself, but I'd be very pleased if someone\n> hacked that up.\n\nErrr... 'git blame -L' supports regexps as starting and ending point,\nsee git-blame(1) manpage:\n\n    git blame -L '/^sub hello {/,/^}$/' foo\n\nIt does not color matching, though...\n-- \nJakub Narębski\n"}]}