Ensure that CLOSE_BRANCHES defaults to ALLOWED_BRANCHES in all cases,
and that ALLOWED_BRANCHES defaults to master. Migrate away from the
deprecated git-config(1) modes and use the newer "git config get"
subcommand instead of "git config --get".
Signed-off-by: Thomas Bracht Laumann Jespersen <laum…@gentoo.org>
---
local/postrecv-bugs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/local/postrecv-bugs b/local/postrecv-bugs
index ffba700..245f759 100755
--- a/local/postrecv-bugs
+++ b/local/postrecv-bugs
@@ -15,8 +15,8 @@ shopt -o -s noglob
# operate on to post comments or close bugs, and mark Codeberg PRs as
# closed/merged. CLOSE_BRANCHES lists the branches where closing bugs
# is permitted and is ideally a subset of ALLOWED_BRANCHES.
-ALLOWED_BRANCHES=$(git config --get gentoo.bugs.allowed-branches)
-CLOSE_BRANCHES=$(git config --get gentoo.bugs.close-branches)
+ALLOWED_BRANCHES=$(git config get --default=master gentoo.bugs.allowed-branches)
+CLOSE_BRANCHES=$(git config get --default="${ALLOWED_BRANCHES}" gentoo.bugs.close-branches)
declare -A COMMENT_BUGS=()
declare -A CLOSE_BUGS=()
@@ -27,7 +27,7 @@ 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
+ for allowed_branch in ${ALLOWED_BRANCHES}; do
if [[ ${refname#refs/heads/} == ${allowed_branch} ]]; then
allowed=1
break
@@ -36,7 +36,7 @@ while read -r oldrev newrev refname; do
[[ ${allowed} == 0 ]] && continue
close_allowed=0
- for close_branch in ${CLOSE_BRANCHES:-${ALLOWED_BRANCHES}}; do
+ for close_branch in ${CLOSE_BRANCHES}; do
if [[ ${refname#refs/heads/} == ${close_branch} ]]; then
close_allowed=1
break
---
base-commit: 9e0fda70b4260f7c3aa386f16af4173a3891ff82
change-id: 20261025-close-branches-defaults-525edb01de27
Best regards,
--
Thomas Bracht Laumann Jespersen <laum…@gentoo.org>
[gentoo-dev] [PATCH infra/githooks] local/postrecv-bugs: improve defaults for {allowed,close}-branches
- From
- Thomas Bracht Laumann Jespersen <laum…@gentoo.org>
- Reply-To
- gent…@lists.gentoo.org
- Sender
- robo…@news.nic.it
- Organization
- linux.* mail to news gateway
- Message-ID
- <NS25…@gated-at.bofh.it>
- Date
- Newsgroups
- linux.gentoo.dev
Moderated This group is moderated.