Commit 3871cd85 authored by Wu, Josh's avatar Wu, Josh Committed by Simon Glass
Browse files

patman: check git format.subjectprefix setting when generate patches prefix

For the local project, we may specified format.subjectprefix setting.
Then the patch will be formated as [Project_prefix][PATCH].
But patman will not check this setting. It will remove the

So This patch will let patman check this setting and add it as a
project prefix.
Signed-off-by: default avatarJosh Wu <>
Acked-by: default avatarSimon Glass <>
Tested-by: default avatarSimon Glass <>
parent 1246231c
......@@ -154,7 +154,11 @@ Series-version: n
Series-prefix: prefix
Sets the subject prefix. Normally empty but it can be RFC for
RFC patches, or RESEND if you are being ignored.
RFC patches, or RESEND if you are being ignored. The patch subject
is like [RFC PATCH] or [RESEND PATCH].
In the meantime, git format.subjectprefix option will be added as
well. If your format.subjectprefix is set to InternalProject, then
the patch shows like: [InternalProject][RFC/RESEND PATCH]
Series-name: name
Sets the name of the series. You don't need to have a name, and
......@@ -545,6 +545,17 @@ def GetDefaultUserEmail():
uemail = command.OutputOneLine('git', 'config', '--global', '')
return uemail
def GetDefaultSubjectPrefix():
"""Gets the format.subjectprefix from local .git/config file.
Subject prefix found in local .git/config file, or None if none
sub_prefix = command.OutputOneLine('git', 'config', 'format.subjectprefix',
return sub_prefix
def Setup():
"""Set up git utils, by reading the alias files."""
# Check for a git alias file also
......@@ -254,6 +254,12 @@ class Series(dict):
Patch string, like 'RFC PATCH v5' or just 'PATCH'
git_prefix = gitutil.GetDefaultSubjectPrefix()
if git_prefix:
git_prefix = '%s][' % git_prefix
git_prefix = ''
version = ''
if self.get('version'):
version = ' v%s' % self['version']
......@@ -262,4 +268,4 @@ class Series(dict):
prefix = ''
if self.get('prefix'):
prefix = '%s ' % self['prefix']
return '%sPATCH%s' % (prefix, version)
return '%s%sPATCH%s' % (git_prefix, prefix, version)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment