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

Re: git am and mangled subject lines

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 24, 2014, 20:38 UTC
Message-ID
<20140224203829.GJ7855@google.com>
In-Reply-To
<530BAA6F.4030401@ubuntu.com>
Hi,
Phillip Susi wrote:
> On 2/24/2014 3:19 PM, Junio C Hamano wrote:
>> Phillip Susi <psusi@ubuntu.com> writes:
Show 10 quoted lines
>>> git am already ignores the "[PATCH X/Y]" prefix that
>>> format-patch adds.  Is it possible to get it to ignore any
>>> additional prefix that a bug tracker mangles into the subject
>>> line?  i.e. "bug #nnnn:"?
>>
>> I think applypatch-msg hook is your friend in a case like this.
>
> Can you point me in the direction of some documentation on this?  I
> don't see it mentioned in the man pages for git am or mailinfo ( I
> would think that would be the place to have it ).
Gladly.
Thanks for noticing.
-- >8 --
Subject: am doc: add a pointer to relevant hooks

It is not obvious when looking at a new command what hooks will affect it. Add a HOOKS section to the git-am(1) page, imitating git-commit(1), to make it easier for people to discover e.g. the applypatch-msg hook that can implement a custom subject-mangling strategy (e.g., removing a "bug #nnnn:" prefix introduced by a bug tracker).

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Documentation/git-am.txt | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 54d8461..abcffb6 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -189,6 +189,11 @@ commits, like running 'git am' on the wrong branch or an error in the
 commits that is more easily fixed by changing the mailbox (e.g.
 errors in the "From:" lines).
 
+HOOKS
+-----
+This command can run `applypatch-msg`, `pre-applypatch`,
+and `post-applypatch` hooks.  See linkgit:githooks[5] for more
+information.
 
 SEE ALSO
 --------
-- 
1.9.0.rc1.175.g0b1dcb5
Previous: Phillip Susi
Message 5 of 5 in “git am and mangled subject lines”
  1. Phillip SusiFeb 24, 2014
  2. Jonathan NiederFeb 24, 2014
  3. Junio C HamanoFeb 24, 2014
  4. Phillip SusiFeb 24, 2014
  5. Jonathan NiederFeb 24, 2014

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.