aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-09-11 20:14:00 +0200
committerMichał Górny <mgorny@gentoo.org>2019-04-09 13:05:55 +0200
commit44664df2a868a0d88536202164755317d7e6c12f (patch)
treef9b7b80388ab54af7663569c0db483bd45980605
parentpostrecv-bugs: Use - instead of _ in config key (diff)
downloadgithooks-44664df2a868a0d88536202164755317d7e6c12f.tar.gz
githooks-44664df2a868a0d88536202164755317d7e6c12f.tar.bz2
githooks-44664df2a868a0d88536202164755317d7e6c12f.zip
bugs: Combine multiple commits into a single message
-rwxr-xr-xlocal/postrecv-bugs38
1 files changed, 29 insertions, 9 deletions
diff --git a/local/postrecv-bugs b/local/postrecv-bugs
index 705078c..1b5ab36 100755
--- a/local/postrecv-bugs
+++ b/local/postrecv-bugs
@@ -12,6 +12,9 @@ shopt -o -s noglob
ALLOWED_BRANCHES=$(git config --get gentoo.bugs.allowed-branches)
+declare -A COMMENT_BUGS=()
+declare -A CLOSE_BUGS=()
+
while read -r oldrev newrev refname; do
# operate only on branches in gentoo.bugs.allowed-branches
# (or 'master' if unset)
@@ -68,24 +71,41 @@ while read -r oldrev newrev refname; do
continue
fi
- if [[ ${close} == 1 ]]; then
- extra_args=( -s RESOLVED -r FIXED )
- newmsg="Bug has been closed via the following commit:"
- else
- extra_args=()
- newmsg="Bug has been referenced in the following commit:"
- fi
+ newmsg="
- newmsg+="
https://gitweb.gentoo.org/${GL_REPO}.git/commit/?id=${commithash}
$(git show --pretty=fuller --date=iso-local --stat "${commithash}")"
# TODO: --show-signature with some nice short output
- bugz modify "${extra_args[@]}" -c "${newmsg}" "${bugno}"
+ if [[ ${close} == 1 ]]; then
+ CLOSE_BUGS[${bugno}]+=${newmsg}
+ else
+ COMMENT_BUGS[${bugno}]+=${newmsg}
+ fi
done
done < <(git show -q --pretty=format:'%B' "${commithash}")
done < <(git rev-list "${oldrev}..${newrev}")
done
+for bug in "${!CLOSE_BUGS[@]}"; do
+ msg="The bug has been closed via the following commit(s):${CLOSE_BUGS[${bug}]}"
+
+ if [[ -n ${COMMENT_BUGS[${bug}]} ]]; then
+ msg+="
+
+Additionally, it has been referenced in the following commit(s):${COMMENT_BUGS[${bug}]}}"
+ fi
+
+ bugz modify -s RESOLVED -r FIXED -c "${msg}" "${bug}"
+done
+
+for bug in "${!COMMENT_BUGS[@]}"; do
+ [[ -n ${CLOSE_BUGS[${bug}]} ]] && continue
+
+ msg="The bug has been referenced in the following commit(s):${COMMENT_BUGS[${bug}]}}"
+
+ bugz modify -c "${msg}" "${bug}"
+done
+
exit 0