From: Jeremiah Mahler Date: Sun, 18 May 2014 17:49:54 GMT Subject: Re: [PATCH v3] format-patch --signature-file 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: > ... > > +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" output2 && test_cmp expect output2 ' -- Jeremiah Mahler jmmahler@gmail.com http://github.com/jmahler