threads / discuss / 35948

git am and mangled subject lines

Subject: git am and mangled subject lines

## tl;dr

5 messages between Feb 24, 2014 and Feb 24, 2014.

replies: 4people: 3as markdown or json

Phillip Susi· Feb 24, 2014, 19:28 UTC · lore
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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:"?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTC51PAAoJEI5FoCIzSKrw5YYH/R6t5fS71UAfFomsD/8HWHoI ve1tIyyruHeriOV8qttlNQGynuEXkI2IBMWJaB7jV5oK8d4OsVQZ/7Nfcxoj52SO JXDSs0MVDB2Ro2lHXRnQsaCy/TUm+ALWsNiTy0kYMTeC7Iqtri1T1l8gaG2rwRJh AGT1sgGssl9CvGFgDHJxRZ4WHSl/XrcjErZeJHz59hGIeJSeq2tJXjfNzNTHrNpw B4rcW8AxXhx+3vWPx8PSJsiVeWR1ndILXwxBsUHPuUW5SdsNBrty1L+4xrGIbxm7 qV7HVJ6BvJ4MXuTEOec3a9ACmvUTDNNMGRf2xonjXMcguojRZHjltRazsI34n8o= =sWTQ -----END PGP SIGNATURE-----

Jonathan Nieder· Feb 24, 2014, 20:05 UTC · re: Phillip Susi · lore

Re: git am and mangled subject lines

Hi Phillip,
Phillip Susi wrote:
> 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:"?

builtin/mailinfo.c is the place to start (see git-mailinfo(1)). This is a little tricky because some people *like* the "bug #nnnn:" in the subject line for a commit.

Hope that helps, Jonathan

Junio C Hamano· Feb 24, 2014, 20:19 UTC · re: Phillip Susi · lore

Re: git am and mangled subject lines

Phillip Susi <psusi@ubuntu.com> writes:
> 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.
Phillip Susi· Feb 24, 2014, 20:24 UTC · re: Junio C Hamano · lore

Re: git am and mangled subject lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2/24/2014 3:19 PM, Junio C Hamano wrote:
Show 8 quoted lines
> Phillip Susi <psusi@ubuntu.com> writes:
> 
>> 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 ).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTC6pvAAoJEI5FoCIzSKrwQpYH/iJ8RPqEoIoO+GBU2HxmCfEZ Tlo1qwbvw26ALY71/WQFtVKW+3Bh1XYpAs0rsL5tpCJw/EMgAEm1cPFASf+BHcRI NO57NBdk9we+hvUju+o6/It5e6OrYj/im+nI/AFfenRsbwPj8/S0MoMiP4jOEVkW tTSCEeC5ldR4IbxBfphbV7me79Sk8nZssXTFmWJEv80H41LdMd8ZThR4ZFCcyzUR ifAflWHN7dj3uwY0Lr+OdCRrPw3qU1LXRjKK2SHBTG1Qk4uJW3sFJKHTupAipOEQ KKQ0QP/4WQWCSjq+8El4jnnlf++KAwbbOnAVYkbeKzy/4KOxJX7pimDypJHYGp8= =LZvc -----END PGP SIGNATURE-----

Jonathan Nieder· Feb 24, 2014, 20:38 UTC · re: Phillip Susi · lore

Re: git am and mangled subject lines

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

← back to recent threads