maintainer tip: git format-patch -k / git am -k

Kamal Mostafa kamal at canonical.com
Tue Jun 4 23:04:39 UTC 2013


Hi kernel repo wranglers ...

If your stable kernel maintenance process involves 'git format-patch'
then 'git am' to extract a set of upstream patches into your branch, you
may want to be aware of this issue.

By default, git format-patch adds the "[PATCH n/m]" prefix to the
Subject: line of each patch file that it generates, and then git am
strips that off again when it extracts the patch title from the Subject:
line.  (Big news, eh? ;-)

The problem... If the original commit already had some bracketed
"[TEXT]" at the start of its title, git am strips that original "[TEXT]"
off too, which is likely not what you intended.

For example, this mainline commit 39c60a0
   "[SCSI] sd: fix array cache flushing bug causing performance problems"
has been applied to some trees with the modified title
   "sd: fix array cache flushing bug causing performance problems"

Bummer if you're trying to find that commit with 'grep SCSI'!

To avoid this problem, you can use git format-patch -k / git am -k,
which will leave your commit titles un-munged ...

   -k, --keep-subject
       Do not strip/add [PATCH] from the first line of the commit log
       message.

Consider whether using -k might be appropriate for your maintenance
workflow.

 -Kamal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20130604/8f393523/attachment.sig>


More information about the kernel-team mailing list