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

Re: [PATCH] builtin-mailinfo.c: Trim only first pair of square brackets in subject

From
RLRoger Leigh <rleigh@codelibre.net>
Date
Jun 29, 2009, 21:49 UTC
Message-ID
<20090629214919.GB5397@codelibre.net>
In-Reply-To
<m3ljnawx3h.fsf@localhost.localdomain>
On Mon, Jun 29, 2009 at 02:26:45PM -0700, Jakub Narebski wrote:
Show 21 quoted lines
> Roger Leigh <rleigh@debian.org> writes:
> 
> > Use a regular expression to match text after "Re:" or any text in the
> > first pair of square brackets such as "[PATCH n/m]".  This replaces
> > the complex hairy string munging with a simple single  pattern match.
> 
> [...]
> > +	/* Strip off 'Re:' and/or the first text in square brackets, such as
> > +	   '[PATCH]' at the start of the mail Subject. */
> > +	status = regcomp(&regex,
> > +			 "^([Rr]e:)?([^]]*\\[[^]]+\\])(.*)$",
> > +			 REG_EXTENDED);
> 
> Sidenote: it probably didn't worked before either, but there are some
> broken mail readers in the wold (*cough* MS Outlook *cough*), that
> misinterpret RFCs and use translated form of "Re:" e.g. "Odp:" (Polish),
> or not strip "Re:" when replying resulting in string of "Re: Re: Re: ...",
> or use capitalized form of "Re:", i.e. "RE:", or use yet another form 
> e.g. compact form of repeated "Re: Re: Re: ..." in form of "Re(3):".
> 
> But I guess it didn't worked before either.
One could update the regex to cope with that easily enough such as
  "^([Rr]e:[[:space:]]*)*([^]]*\\[[^]]+\\])(.*)$"

for the "Re: Re: Re:" case, though I can't say I've seen anything except "Re:" for years. Maybe I just don't get mail and patches from Outlook users ;-)

Regards, Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
Previous: Jakub NarebskiNext: Neil Roberts
Message 10 of 21 in “git mailinfo strips important context from patch subjects”
  1. Roger LeighJun 28, 2009
  2. Jeff KingJun 28, 2009
  3. Junio C HamanoJun 28, 2009
  4. Andreas EricssonJun 29, 2009
  5. mailinfo: Remove only one set of square bracketsAndreas Ericsson, Jun 29, 2009
  6. Junio C HamanoJun 29, 2009
  7. Jeff KingJun 30, 2009
  8. builtin-mailinfo.c: Trim only first pair of square brackets in subjectRoger Leigh, Jun 29, 2009
  9. Jakub NarebskiJun 29, 2009
  10. Roger LeighJun 29, 2009
  11. Neil RobertsSep 22, 2009
  12. Neil RobertsSep 22, 2009
  13. Junio C HamanoSep 22, 2009
  14. Neil RobertsSep 22, 2009
  15. Jason HoldenSep 23, 2009
  16. 2/2 builtin-mailinfo.c: Free regular expression after useRoger Leigh, Jun 29, 2009
  17. Roger LeighJun 29, 2009
  18. git mailinfo strips important context from patch subjectsPaolo Bonzini, Jun 28, 2009
  19. Andreas EricssonJun 29, 2009
  20. Paolo BonziniJun 29, 2009
  21. Andreas EricssonJun 29, 2009

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.