Re: A shortcoming of the git repo format
- From
Jon Seymour <jon.seymour@gmail.com>
- Date
- Apr 27, 2005, 22:51 UTC
- Message-ID
- <2cfc403205042715513d8123f3@mail.gmail.com>
- In-Reply-To
- <426FDE48.1050700@zytor.com>
On 4/28/05, H. Peter Anvin <hpa@zytor.com> wrote:
Show 12 quoted lines
> 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 \\012jon
-- homepage: http://www.zeta.org.au/~jon/ blog: http://orwelliantremors.blogspot.com/