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

[PATCH v2] format-patch --signature-file <file>

From
Jeremiah Mahler <jmmahler@gmail.com>
Date
May 16, 2014, 01:31 UTC
Message-ID
<1400203881-2794-1-git-send-email-jmmahler@gmail.com>
On Tue, May 13, 2014 at 09:07:12AM -0700, Jonathan Nieder wrote:
Show 17 quoted lines
> Hi,
> 
> Jeremiah Mahler wrote:
> 
> >   # from a string
> >   $ git format-patch --signature "from a string" origin
> >
> >   # or from a file
> >   $ git format-patch --signature ~/.signature origin
> 
> Interesting.  But... what if I want my patch to end with
> 
> 	-- 
> 	/home/jrnieder/.signature
> 
> ?  It seems safer to introduce a separate --signature-file option.
> 

It is probably smarter to avoid that corner case entirely. Good idea.

Show 6 quoted lines
> [...]
> >  builtin/log.c | 26 ++++++++++++++++++++++++--
> >  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> Tests?
> 

I added a test which checks that a valid patch is produced and that the signature from the file appears in the output.

> Thanks and hope that helps,
> Jonathan

In addition to addressing the suggestions from Jonathan I also updated the Documentation.

This solution uses a static buffer to store the signature which does create a size limitation (1024 bytes). I considered a solution using malloc but I could not figure out a clean way of determining when to free the memory.

Thanks for the help and suggestions.
Jeremiah Mahler (1):
  format-patch --signature-file <file>
 Documentation/git-format-patch.txt |  7 +++++++
 builtin/log.c                      | 24 ++++++++++++++++++++++++
 t/t4014-format-patch.sh            | 13 +++++++++++++
 3 files changed, 44 insertions(+)
-- 
Jeremiah Mahler
jmmahler@gmail.com
http://github.com/jmahler
Next: Jeremiah Mahler
Message 1 of 13 in “format-patch --signature-file <file>”
  1. format-patch --signature-file <file>Jeremiah Mahler, May 16, 2014
  2. format-patch --signature-file <file>Jeremiah Mahler, May 16, 2014
  3. Jeff KingMay 16, 2014
  4. Jeremiah MahlerMay 17, 2014
  5. Jeff KingMay 17, 2014
  6. Jeremiah MahlerMay 17, 2014
  7. Jeff KingMay 17, 2014
  8. Jeremiah MahlerMay 17, 2014
  9. Junio C HamanoMay 19, 2014
  10. Jeremiah MahlerMay 20, 2014
  11. Jeff KingMay 20, 2014
  12. Junio C HamanoMay 20, 2014
  13. Jeremiah MahlerMay 21, 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.