summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_command.py2
-rwxr-xr-xhooks/commit-msg19
-rw-r--r--project.py2
3 files changed, 17 insertions, 6 deletions
diff --git a/git_command.py b/git_command.py
index 63b7b6f2..9f7d2930 100644
--- a/git_command.py
+++ b/git_command.py
@@ -170,7 +170,7 @@ class GitCommand(object):
170 _setenv(env, 'GIT_CONFIG_PARAMETERS', s) 170 _setenv(env, 'GIT_CONFIG_PARAMETERS', s)
171 if 'GIT_ALLOW_PROTOCOL' not in env: 171 if 'GIT_ALLOW_PROTOCOL' not in env:
172 _setenv(env, 'GIT_ALLOW_PROTOCOL', 172 _setenv(env, 'GIT_ALLOW_PROTOCOL',
173 'file:git:http:https:ssh:persistent-http:persistent-https:sso') 173 'file:git:http:https:ssh:persistent-http:persistent-https:sso:rpc')
174 174
175 if project: 175 if project:
176 if not cwd: 176 if not cwd:
diff --git a/hooks/commit-msg b/hooks/commit-msg
index d8f009b6..40ac237a 100755
--- a/hooks/commit-msg
+++ b/hooks/commit-msg
@@ -1,6 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# From Gerrit Code Review 2.12.1
2# 3#
3# Part of Gerrit Code Review (http://code.google.com/p/gerrit/) 4# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
4# 5#
5# Copyright (C) 2009 The Android Open Source Project 6# Copyright (C) 2009 The Android Open Source Project
6# 7#
@@ -19,7 +20,7 @@
19 20
20unset GREP_OPTIONS 21unset GREP_OPTIONS
21 22
22CHANGE_ID_AFTER="Bug|Issue" 23CHANGE_ID_AFTER="Bug|Issue|Test"
23MSG="$1" 24MSG="$1"
24 25
25# Check for, and add if missing, a unique Change-Id 26# Check for, and add if missing, a unique Change-Id
@@ -38,6 +39,12 @@ add_ChangeId() {
38 return 39 return
39 fi 40 fi
40 41
42 # Do not add Change-Id to temp commits
43 if echo "$clean_message" | head -1 | grep -q '^\(fixup\|squash\)!'
44 then
45 return
46 fi
47
41 if test "false" = "`git config --bool --get gerrit.createChangeId`" 48 if test "false" = "`git config --bool --get gerrit.createChangeId`"
42 then 49 then
43 return 50 return
@@ -57,6 +64,10 @@ add_ChangeId() {
57 AWK=/usr/xpg4/bin/awk 64 AWK=/usr/xpg4/bin/awk
58 fi 65 fi
59 66
67 # Get core.commentChar from git config or use default symbol
68 commentChar=`git config --get core.commentChar`
69 commentChar=${commentChar:-#}
70
60 # How this works: 71 # How this works:
61 # - parse the commit message as (textLine+ blankLine*)* 72 # - parse the commit message as (textLine+ blankLine*)*
62 # - assume textLine+ to be a footer until proven otherwise 73 # - assume textLine+ to be a footer until proven otherwise
@@ -75,8 +86,8 @@ add_ChangeId() {
75 blankLines = 0 86 blankLines = 0
76 } 87 }
77 88
78 # Skip lines starting with "#" without any spaces before it. 89 # Skip lines starting with commentChar without any spaces before it.
79 /^#/ { next } 90 /^'"$commentChar"'/ { next }
80 91
81 # Skip the line starting with the diff command and everything after it, 92 # Skip the line starting with the diff command and everything after it,
82 # up to the end of the file, assuming it is only patch data. 93 # up to the end of the file, assuming it is only patch data.
diff --git a/project.py b/project.py
index 6e8dcbe7..e3c3bd51 100644
--- a/project.py
+++ b/project.py
@@ -496,7 +496,7 @@ class RepoHook(object):
496 496
497 # Exec, storing global context in the context dict. We catch exceptions 497 # Exec, storing global context in the context dict. We catch exceptions
498 # and convert to a HookError w/ just the failing traceback. 498 # and convert to a HookError w/ just the failing traceback.
499 context = {} 499 context = {'__file__': self._script_fullpath}
500 try: 500 try:
501 exec(compile(open(self._script_fullpath).read(), 501 exec(compile(open(self._script_fullpath).read(),
502 self._script_fullpath, 'exec'), context) 502 self._script_fullpath, 'exec'), context)