Re: [PATCH v3] format-patch --signature-file <file>
- From
Jeremiah Mahler <jmmahler@gmail.com>
- Date
- May 18, 2014, 17:49 UTC
- Message-ID
- <20140518174954.GA30558@hudson.localdomain>
- In-Reply-To
- <20140518112020.GA2153@sigill.intra.peff.net>
Peff,
Lots of good suggestions. I had to expand upon the signature pattern match to get to work.
On Sun, May 18, 2014 at 07:20:20AM -0400, Jeff King wrote:
> On Sat, May 17, 2014 at 09:02:22AM -0700, Jeremiah Mahler wrote: >
...
Show 13 quoted lines
> > +test_expect_success 'format-patch --signature-file file' ' > > + git format-patch --stdout --signature-file expect -1 >output && > > + check_patch output && > > + fgrep -x -f output expect >output2 && > > Both of these fgrep options are in POSIX, but it looks like this will be > the first use for either of them. I'm not sure if they will give us any > portability problems. > > We could probably do something like: > > sed -n '/^-- $/,$p' >
This gets the signature out but it will have '--' and some trailing blank lines which were not in the original signature. So then test_cmp won't work directly.
What I came up with was to use head and tail to remove the first line and the last two lines. Then test_cmp can be used normally.
test_expect_success 'format-patch --signature-file=file' ' git format-patch --stdout --signature-file=expect -1 >output && check_patch_output output && sed -n "/^-- $/,\$p" <output | head --lines=-2 | tail --lines=+2 >output2 && test_cmp expect output2 '
-- Jeremiah Mahler jmmahler@gmail.com http://github.com/jmahler