From: "Brian C. Lane" <bcl(a)redhat.com>
---
scripts/githooks/commit-msg | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/scripts/githooks/commit-msg b/scripts/githooks/commit-msg
index a360dbb..aa3a93e 100755
--- a/scripts/githooks/commit-msg
+++ b/scripts/githooks/commit-msg
@@ -15,18 +15,20 @@
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
- echo >&2 Duplicate Signed-off-by lines.
- exit 1
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
+ echo >&2 Duplicate Signed-off-by lines.
+ exit 1
}
# Make sure commits on RHEL branches reference RHEL bugs.
RETVAL=0
-git branch | grep ^* | cut -c3- | grep -q ^rhel
-if [ $? -eq 1 ]; then
+branch_name=$(git branch | grep ^* | cut -c3-)
+branch_pattern="^rhel([[:digit:]])-branch"
+if [[ ! "$branch_name" =~ $branch_pattern ]]; then
exit ${RETVAL}
fi
+RELEASE=${BASH_REMATCH[1]}
if [ -f "${HOME}/.rhbzauth" ]; then
. "${HOME}/.rhbzauth"
@@ -51,6 +53,16 @@ else
${bzcmd} login
fi
+bz_has_ack() {
+ bug=$1
+ flags=$(${bzcmd} query --bug_id=${bug} --outputformat="%{flags}")
+
+ ack_pattern="rhel-${RELEASE}\.[[:digit:]]+\.[[:digit:]]+\+"
+ if [[ ! "$flags" =~ $ack_pattern ]]; then
+ echo "*** BZ ${bug} is missing acks: ${flags}"
+ fi
+}
+
summary="$(head -n 1 ${1})"
for word in ${summary} ; do
echo "${word}" | grep -q -E "^.*(#[0-9]+).*"
@@ -61,6 +73,7 @@ for word in ${summary} ; do
echo "*** BZ ${bug} is not a RHEL bug." >&2
RETVAL=1
fi
+ bz_has_ack ${bug}
fi
done
@@ -75,6 +88,7 @@ if [ ${last} -gt 0 ]; then
echo "*** BZ ${bug} is not a RHEL bug." >&2
RETVAL=1
fi
+ bz_has_ack ${bug}
done
fi
--
1.8.3.1