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

Re: [PATCH] signature-format.txt: explain and illustrate multi-line headers

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2021, 17:17 UTC
Message-ID
<xmqq5ytzcyr6.fsf@gitster.g>
In-Reply-To
<87zgrcgpez.fsf@trouble.defaultvalue.org>
Rob Browning <rlb@defaultvalue.org> writes:
> One question I had was whether git's requirement was strictly a space,
> or if it was following the rfc-822 convention where (if I remember
> correctly) a tab is equivalent, i.e. the LWSP production in the grammar.

We use a single SP when writing and we accept a single SP when reading. See commit.c::add_extra_header() for the writing side, and commit.c::read_commit_extra_header_lines() for the reading side.

Unlike in RFC-822 style e-mail headers, 
 * keywords in our object headers are not followed by a colon;
 * the value carried on our object header is not a "logically a
   single line of characters".  
 * our headers do not go through their "unfolding" (i.e. removal of
   CRLF eol markers to form a single long line, while preserving the
   WSP that immediately followed the CRLF).  We instead remove the
   SP that signalled the line as a continuation of the previous line
   to keep the original line structure.

With so little similarity, there is no reason for us to mimick their "folding" rule.

We limit to the SP and not LWP for another reason. Because the exact byte sequence in the object (including the header part of "commit" and "tag" objects) determines the name of the object, it avoids ambiguity to make sure we do not allow unnecessary "flexibility" in the way the same thing can be expressed. If the same signature is attached to a pair of otherwise identical commits in their headers, one with SP signaling continued lines, the other using HT (or random permutations of choice between SP/HT---making 2^N variants for a N line signature block), we would needlessly create many variants of the "same" commit, which is not ideal.

Previous: Rob BrowningNext: Rob Browning
Message 8 of 11 in “signature-format.txt: add space to fix gpgsig continuation line”
  1. 1/1 signature-format.txt: add space to fix gpgsig continuation lineRob Browning, Oct 9, 2021
  2. Jeff KingOct 11, 2021
  3. Junio C HamanoOct 11, 2021
  4. Jeff KingOct 12, 2021
  5. Junio C HamanoOct 12, 2021
  6. signature-format.txt: explain and illustrate multi-line headersJunio C Hamano, Oct 13, 2021
  7. Rob BrowningOct 14, 2021
  8. Junio C HamanoOct 14, 2021
  9. Rob BrowningOct 15, 2021
  10. Junio C HamanoOct 15, 2021
  11. Rob BrowningOct 15, 2021

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.