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

Re: generating format-patch options from an e-mail

From
Jeff King <peff@peff.net>
Date
Dec 26, 2012, 21:57 UTC
Message-ID
<20121226215712.GA11491@sigill.intra.peff.net>
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:
Show 6 quoted lines
> > 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
Previous: Pyeron, Jason J CTR (US)
Message 5 of 5 in “generating format-patch options from an e-mail”
  1. Simon OosthoekDec 26, 2012
  2. Junio C HamanoDec 26, 2012
  3. Simon OosthoekDec 26, 2012
  4. Pyeron, Jason J CTR (US)Dec 26, 2012
  5. Jeff KingDec 26, 2012

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.