Skip to contentSkip to conversation

git am and mangled subject lines

DISCUSSION Phillip Susi 3 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

-----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-----

#1 lore raw

Hi Phillip,

Quoted 3 lines · Phillip Susi

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

#2 lore raw
In reply to Phillip Susi
Quoted 3 lines · Phillip Susi

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.

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Junio C Hamano
Quoted 4 lines · Phillip Susi

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-----

#4 lore raw

Hi,

Quoted 8 lines · Phillip Susi
Quoted 7 lines · Junio C Hamano
Quoted 4 lines · Phillip Susi

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

Quoted 5 lines
Quoted 1 line

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).

---
 Documentation/git-am.txt | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/git-am.txt +5 -0
index 54d8461..abcffb6 100644
@@ -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
 --------
Signature · 1 line
1.9.0.rc1.175.g0b1dcb5