diff options
author | 2020-01-09 20:20:07 -0800 | |
---|---|---|
committer | 2020-01-09 20:20:07 -0800 | |
commit | bcc5e68536fbffd1f293eda1d7918444cbebc410 (patch) | |
tree | b6e2e3caa495fa09eab33a50db1f4a880968b862 | |
parent | notify-webhook: more cleanups (diff) | |
download | githooks-bcc5e68536fbffd1f293eda1d7918444cbebc410.tar.gz githooks-bcc5e68536fbffd1f293eda1d7918444cbebc410.tar.bz2 githooks-bcc5e68536fbffd1f293eda1d7918444cbebc410.zip |
local/update-02-gpg: perform branch selection before validating signatures
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | local/update-02-gpg | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/local/update-02-gpg b/local/update-02-gpg index e61c7aa..c34e953 100755 --- a/local/update-02-gpg +++ b/local/update-02-gpg @@ -19,6 +19,24 @@ if [ -z "${refname}" -o -z "${oldrev}" -o -z "${newrev}" ]; then exit 1 fi +case ${SIGNED_BRANCHES} in + all-refs) + ;; + all) + [[ ${refname} == refs/heads/* ]] || exit 0 + ;; + *) + [[ ${refname} == refs/heads/* ]] || exit 0 + branch_found= + for branch in ${SIGNED_BRANCHES}; do + if [[ ${refname#refs/heads/} == ${branch} ]]; then + branch_found=1 + break + fi + done + [[ ${branch_found} == 1 ]] || exit 0 +esac + # branch names or 'all', or 'all-refs' for all refs SIGNED_BRANCHES=$(git config --get gentoo.signed-branches) : ${SIGNED_BRANCHES:=master} @@ -72,24 +90,6 @@ case ${VERIFY_SIGS} in exit 1 esac -case ${SIGNED_BRANCHES} in - all-refs) - ;; - all) - [[ ${refname} == refs/heads/* ]] || exit 0 - ;; - *) - [[ ${refname} == refs/heads/* ]] || exit 0 - branch_found= - for branch in ${SIGNED_BRANCHES}; do - if [[ ${refname#refs/heads/} == ${branch} ]]; then - branch_found=1 - break - fi - done - [[ ${branch_found} == 1 ]] || exit 0 -esac - IFS=' ' |