git-format-patch should include a checksum

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

git-format-patch should include a checksum

From: Juliusz Chroboczek <hidden>
Date: 2016-06-15 22:48:06

Hi,

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).

                                        Juliusz

Re: git-format-patch should include a checksum

From: Sverre Rabbelier <hidden>
Date: 2016-06-15 22:48:06

Heya,

On Tue, Jan 26, 2010 at 23:34, Juliusz Chroboczek [off-list ref] wrote:
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help