git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sverre Rabbelier <srabbelier@gmail.com>
To: Juliusz Chroboczek <jch@pps.jussieu.fr>
Cc: git@vger.kernel.org
Subject: Re: git-format-patch should include a checksum
Date: Wed, 27 Jan 2010 00:15:28 +0100	[thread overview]
Message-ID: <fabb9a1e1001261515w44ccf7a4le6a49724164e902c@mail.gmail.com> (raw)
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:
> 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

  reply	other threads:[~2010-01-26 23:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 22:34 git-format-patch should include a checksum Juliusz Chroboczek
2010-01-26 23:15 ` Sverre Rabbelier [this message]
2010-01-26 23:21 ` Junio C Hamano
2010-01-26 23:26   ` Sverre Rabbelier
2010-01-27  0:45     ` Linus Torvalds
2010-01-27  0:50       ` Sverre Rabbelier
2010-01-27  1:13         ` Nicolas Pitre
2010-01-27  1:25           ` Junio C Hamano
2010-01-27  1:25   ` Juliusz Chroboczek
2010-01-27  1:35     ` Junio C Hamano
2010-01-27  3:01     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fabb9a1e1001261515w44ccf7a4le6a49724164e902c@mail.gmail.com \
    --to=srabbelier@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jch@pps.jussieu.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).