summaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-09-04 16:45:16 +0200
committerMichał Górny <mgorny@gentoo.org>2019-04-09 13:05:55 +0200
commit9de98542f89e932d86b4e8b0213853fd6bab507a (patch)
tree35f824dd3e2083303b014806fabf04561af00a28 /local
parentpostrecv-bugs: Fix accidental indent inside message (diff)
downloadgithooks-9de98542f89e932d86b4e8b0213853fd6bab507a.tar.gz
githooks-9de98542f89e932d86b4e8b0213853fd6bab507a.tar.bz2
githooks-9de98542f89e932d86b4e8b0213853fd6bab507a.zip
postrecv-bugs: Limit operation to specified branches
Limit the activity of bug closing hook to specified branches ('master' by default) to prevent prematurely closing bugs when commits are pushed to staging branches.
Diffstat (limited to 'local')
-rwxr-xr-xlocal/postrecv-bugs13
1 files changed, 13 insertions, 0 deletions
diff --git a/local/postrecv-bugs b/local/postrecv-bugs
index b646a22..ece65b0 100755
--- a/local/postrecv-bugs
+++ b/local/postrecv-bugs
@@ -10,7 +10,20 @@ export TZ=UTC
shopt -o -s noglob
+ALLOWED_BRANCHES=$(git config --get gentoo.bugs.allowed_branches)
+
while read -r oldrev newrev refname; do
+ # operate only on branches in gentoo.bugs.allowed_branches
+ # (or 'master' if unset)
+ allowed=0
+ for allowed_branch in ${ALLOWED_BRANCHES:-master}; do
+ if [[ ${refname#refs/heads/} == ${allowed_branch} ]]; then
+ allowed=1
+ break
+ fi
+ done
+ [[ ${allowed} == 0 ]] && continue
+
while read -r commithash; do
while read -r l; do
case ${l} in