From: Jon Seymour Date: Wed, 27 Apr 2005 22:51:15 GMT Subject: Re: A shortcoming of the git repo format Message-ID: <2cfc403205042715513d8123f3@mail.gmail.com> In-Reply-To: <426FDE48.1050700@zytor.com> On 4/28/05, H. Peter Anvin wrote: > Dave Jones wrote: > > > > That actually broke one of my first git scripts when one of the > > changelog texts started a line with 'tree '. I hacked around it > > by making my script only grep in the 'head -n4' lines, but this > > seems somewhat fragile having to make assumptions that the field > > I want to see is in the first 4 lines. > > > > You have the delimiter for that; there is an empty line between the > header and the free-form body, similar as for RFC822. > ...and a relatively simple way to use that rule to extract just the header lines: sed -n "1,/^\$/p" # with the separator line or, either one of these to remove the separator line as well: sed -n "1,/^\$/s/^\(..*\)/\1/p" sed -n "1,/^\$/p" | tr -s \\012 jon -- homepage: http://www.zeta.org.au/~jon/ blog: http://orwelliantremors.blogspot.com/