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

Re: git-format-patch should include a checksum

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Jan 26, 2010, 23:15 UTC
Message-ID
<fabb9a1e1001261515w44ccf7a4le6a49724164e902c@mail.gmail.com>
In-Reply-To
<871vhcmr5b.fsf@trurl.pps.jussieu.fr>
Heya,
On Tue, Jan 26, 2010 at 23:34, Juliusz Chroboczek <jch@pps.jussieu.fr> wrote:
Show 5 quoted lines
> I'm seeing Git patches being corrupted by mailers and still apply
> correctly.  It would be great if git-format-patch could include a hash
> of the patch body (and commit message); git-am should check the hash,
> and refuse to commit if the patch was corrupted (--force should override
> that, of course).

Sounds like a good idea, have a look at cmd_format_patch in builtin-log.c. Assuming you want to add the hash as a X- mail header (e.g. X-Git-Message-Hash), you should probably add it before line 1019 (where rev.extra_headers is set to the current contents of 'buf'). For the hash itself have a look at git_SHA1_{Init,Update,Final} in various files, csum-file.c would seem like an excellent candidate, as it writes a sha1-summed file, which is sortof what you want to do.

For the git-am part look at 'git-am.sh', you should have checking logic warn only at first, and add a configuration option that allows enforcing it and warn when the option isn't set, instructing the user how to configure the option, see warn_unconfigured_deny_msg in builtin-receive-pack.c. A few releases from now we can set it from warn to abort (or deny, whatever the enforcing option is called).

Good luck!
-- 
Cheers,

Sverre Rabbelier
Previous: Juliusz ChroboczekNext: Junio C Hamano
Message 2 of 11 in “git-format-patch should include a checksum”
  1. Juliusz ChroboczekJan 26, 2010
  2. Sverre RabbelierJan 26, 2010
  3. Junio C HamanoJan 26, 2010
  4. Sverre RabbelierJan 26, 2010
  5. Linus TorvaldsJan 27, 2010
  6. Sverre RabbelierJan 27, 2010
  7. Nicolas PitreJan 27, 2010
  8. Junio C HamanoJan 27, 2010
  9. Juliusz ChroboczekJan 27, 2010
  10. Junio C HamanoJan 27, 2010
  11. Junio C HamanoJan 27, 2010

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.