diff options
author | Oleh Kravchenko <oleg@kaa.org.ua> | 2015-11-13 09:11:30 +0200 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-09 09:52:56 +0000 |
commit | f679bc892965fe61eff07c85aab8fed81ba263e5 (patch) | |
tree | 86cd8c7c9ceddf507ef3c71bfce155a36742ba52 | |
parent | 6da22828da01b5dfdc07beb9e912cf5db927018e (diff) |
commit-msg: respect commentChar from git-config
This patch-set allows to use typical notation for adding commit link to
ticket in Trac issue tracker.
Example of commit message for Trac:
#12345 Fix wrong filename
Bug: Issue 3883
Change-Id: I19bc1d617870da6e6fc1e23d49c646dc14236815
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
(cherry picked from commit 0d41be9965e6c83c1ec388c1917276148f54117b)
-rw-r--r-- | gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg b/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg index b537f265de..aace2b328b 100644 --- a/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg +++ b/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg @@ -63,6 +63,10 @@ add_ChangeId() { AWK=/usr/xpg4/bin/awk fi + # Get core.commentChar from git config or use default symbol + commentChar=`git config --get core.commentChar` + commentChar=${commentChar:-#} + # How this works: # - parse the commit message as (textLine+ blankLine*)* # - assume textLine+ to be a footer until proven otherwise @@ -81,8 +85,8 @@ add_ChangeId() { blankLines = 0 } - # Skip lines starting with "#" without any spaces before it. - /^#/ { next } + # Skip lines starting with commentChar without any spaces before it. + /^'"$commentChar"'/ { next } # Skip the line starting with the diff command and everything after it, # up to the end of the file, assuming it is only patch data. |