git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Pyeron, Jason J CTR (US)" <jason.j.pyeron.ctr@mail.mil>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: generating format-patch options from an e-mail
Date: Wed, 26 Dec 2012 16:57:12 -0500	[thread overview]
Message-ID: <20121226215712.GA11491@sigill.intra.peff.net> (raw)
In-Reply-To: <871B6C10EBEFE342A772D1159D1320853A00DD2E@umechphj.easf.csd.disa.mil>

On Wed, Dec 26, 2012 at 09:31:46PM +0000, Pyeron, Jason J CTR (US) wrote:

> > That would work for the message-ID, but not for the various To: and Cc:
> > addresses.
> > 
> > The hacky script that I sent afterwards produces a string with the
> 
> Nit, it does not make use of the reply-to header if present.

I do something very similar to Simon, except that rather than generating
a reply with my script, I generate the cover letter in my MUA, and then
use that response as a template. So the MUA does the heavy lifting,
understanding reply-to, culling my own address from cc, etc. The
format-patch replies then have the exact same to/cc headers as the
template, and use the template's message-id as the in-reply-to (for
proper threading).

My perl looks like this (feed the template via stdin):

  perl -ne '
    if (defined $opt && /^\s+(.*)/) {
      $val .= " $1";
      next;
    }
    if (defined $opt) {
      print "--$opt=", quotemeta($val), " ";
      $opt = $val = undef;
    }
    if (/^(cc|to):\s*(.*)/i) {
      $opt = lc($1);
      $val = $2;
    }
    elsif (/^message-id:\s*(.*)/i) {
      $opt = "in-reply-to";
      $val = $1;
    }
  '

That, of course, presupposes a cover letter. If I am sending a single
patch, then I just do "format-patch --stdout" right into my MUA's
editor), and let it handle the headers.

-Peff

  reply	other threads:[~2012-12-26 21:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-26 20:06 generating format-patch options from an e-mail Simon Oosthoek
2012-12-26 20:35 ` Junio C Hamano
2012-12-26 21:07   ` Simon Oosthoek
2012-12-26 21:31     ` Pyeron, Jason J CTR (US)
2012-12-26 21:57       ` Jeff King [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-26 20:28 Simon Oosthoek

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=20121226215712.GA11491@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jason.j.pyeron.ctr@mail.mil \
    /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).