git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jeff King
Message 4 of 4 in “format-patch --signature-file <file>”
  1. format-patch --signature-file <file>Jeremiah Mahler, May 17, 2014
  2. format-patch --signature-file <file>Jeremiah Mahler, May 17, 2014
  3. Jeff KingMay 18, 2014
  4. Jeremiah MahlerMay 18, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.