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

git mailinfo strips important context from patch subjects

From
RLRoger Leigh <rleigh@codelibre.net>
Date
Jun 28, 2009, 19:38 UTC
Message-ID
<20090628193858.GA29467@codelibre.net>

[I'm not currently subscribed to the list; I'd appreciate a CC on any replies, thanks!]

Hi,

In most of the projects I work on, the git commit message has the affected subsystem or component in square brackets, such as

  [foo] change bar to baz

For example, with a single patch from a series produced by git format-patch:

% head -n4 /tmp/patches/0005-sbuild-chroot_mountable-Don-t-derive-from-chroot.patch
From f01579584f1e7d77cf1e9c3306601a4cccff8c55 Mon Sep 17 00:00:00 2001
From: Roger Leigh <rleigh@debian.org>
Date: Fri, 10 Apr 2009 19:43:15 +0100
Subject: [PATCH 05/15] [sbuild] chroot_mountable: Don't derive from chroot
% git mailinfo </tmp/patches/0005-sbuild-chroot_mountable-Don-t-derive-from-chroot.patch /dev/null /dev/null
Author: Roger Leigh
Email: rleigh@debian.org
Subject: chroot_mountable: Don't derive from chroot
Date: Fri, 10 Apr 2009 19:43:15 +0100

The [sbuild] prefix has been dropped from the Subject, so an important bit of context about the patch has been lost.

It's a bit of a bug that you can't round trip from a git-format-patch to import with git-am and then not be able to produce the exact same patch set with git-format-patch again (assuming preparing and applying to the same point, of course).

Would it be possible to change the git-mailinfo logic to use a less greedy pattern match so it leaves everything after ([PATCH( [0-9/])+])+ in the subject? AFAICT this is cleanup_subject in builtin-mailinfo.c? Could this rather complex function not just do a simple regex match which can also take care of stripping ([Rr]e:) ?

Thanks, 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.
Next: Jeff King
Message 1 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.