On Mon, May 25, 2020 at 10:57:51PM +0100, Philip Oakley wrote: > The sed script removes the last hex digit from boundary commit oids > '^hexx msg' -> '^hex msg' until all leading hex's are gone, finally > removing the boundary commit marker. Thanks for documenting this, as the sed was rather hard to read: > +test_expect_success 'test -b option, blank oid for boundary commits' ' > + git blame -b branch1.. -- file >actual && > + git blame branch1.. -- file >full && > + sed -e "/^\^/{ > + :loop; > + s/^\(\^[0-9a-f]*\)[0-9a-f] \(.*\)/\1 \2/g; > + tloop; > + s/^\^/ /; > + }" full >expected && I wonder if we can make it simpler. In perl I'd probably just replace the whole string with the equivalent number of spaces, like: perl -pe 's/^\^\S+/" " x length($&)/e' but I suppose some would consider that pretty magical, too. It might be simpler still to just avoid testing leading whitespace: sed 's/^\^[0-9a-f]* *//' <full >expected && sed 's/^ *//' <actual >actual.stripped && test_cmp expected actual.stripped but perhaps the indentation is a useful part of what we're testing. -Peff