From: Jeff King Date: Fri, 06 May 2011 22:13:00 GMT Subject: Re: [PATCH 1/2] tests: eliminate unnecessary setup test assertions Message-ID: <20110506221300.GB17848@sigill.intra.peff.net> In-Reply-To: <20110506214801.GA17848@sigill.intra.peff.net> On Fri, May 06, 2011 at 05:48:01PM -0400, Jeff King wrote: > pattern_authors() { > git grep -n "$@" | > while IFS=: read file line match; do > git blame -L "$line,$line" "$file" > done | > perl -lpe '/\((.*?) \d+-\d+-\d+/; $_=$1' > } Two minor complaints on git-blame; maybe somebody can point out something clever I've missed. 1. blame's "-L" understands patterns already. So in theory I could tell it "blame all lines that match pattern X". But I don't think there is a way to do that (it tries looking to for _one_ range to blame for each -L, not a set of ranges). 2. Parsing the human-readable output blame output sucks. But parsing --porcelain is annoyingly complex for quick-and-dirty things like this. It doesn't repeat the commit information per-line. I guess we could have an inefficient --line-porcelain format that breaks down ranges into single lines and repeats the commit info for each one. The clever among you may notice that in this particular case, though, I could have gotten away with regular --porcelain as I blame a single line at a time. -Peff