aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-04-09 12:59:54 +0200
committerMichał Górny <mgorny@gentoo.org>2019-04-09 13:05:56 +0200
commit0c4176c8f444079bb746136f9d71987bc4344cac (patch)
tree974aaa3dd3b716c676869331918d087dc10a7a87
parentupdate-02-gpg: Start enforcing GLEP 63 for commits (diff)
downloadgithooks-0c4176c8f444079bb746136f9d71987bc4344cac.tar.gz
githooks-0c4176c8f444079bb746136f9d71987bc4344cac.tar.bz2
githooks-0c4176c8f444079bb746136f9d71987bc4344cac.zip
Remove stale hooks
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rwxr-xr-xlocal/post-update33
-rwxr-xr-xlocal/update121
2 files changed, 0 insertions, 154 deletions
diff --git a/local/post-update b/local/post-update
deleted file mode 100755
index ba58c61..0000000
--- a/local/post-update
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-egencached_pidfile="~/egencache.pid"
-
-# --- Command line
-refname=${1}
-oldrev=${2}
-newrev=${3}
-
-# --- Safety check
-if [ -z "${GIT_DIR}" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " ${0} <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "${refname}" -o -z "${oldrev}" -o -z "${newrev}" ]; then
- echo "usage: ${0} <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-case ${refname} in
- refs/heads/master)
- # trigger cache regen
- kill -HUP "$(cat "${egencached_pidfile}")"
- ;;
- *)
- ;;
-esac
-
-# --- Finished
-exit 0
diff --git a/local/update b/local/update
deleted file mode 100755
index b81c6e5..0000000
--- a/local/update
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/sh
-
-egencached_pidfile=/home/mgorny/egencache.pid
-
-# --- Command line
-refname=${1}
-oldrev=${2}
-newrev=${3}
-
-# --- Safety check
-if [ -z "${GIT_DIR}" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " ${0} <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "${refname}" -o -z "${oldrev}" -o -z "${newrev}" ]; then
- echo "usage: ${0} <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero="0000000000000000000000000000000000000000"
-
-case ${refname} in
- refs/tags/*)
- echo "*** Tags are not allowed in gx86" >&2
- exit 1
- ;;
- refs/heads/master)
- if [ "${newrev}" = "${zero}" ]; then
- echo "*** Errr, removing master is not allowed" >&2
- exit 1
- fi
-
- # prevent forced updates
- # http://stackoverflow.com/questions/10319110/how-to-detect-a-forced-update
- if [ -n "$(git rev-list "${oldrev}" "^${newrev}")" ]; then
- echo "*** Forced update disallowed!" >&2
- exit 1
- fi
-
- IFS='
-'
-
- # check that tree is sane
- # (we don't have to filter out removals -- the files weren't
- # allowed, so we won't remove them :))
- cfiles=$(git diff --name-only "${oldrev}".."${newrev}")
- for name in ${cfiles}; do
- case ${name} in
- */ChangeLog)
- echo "*** ChangeLogs are not allowed in the repository"
- exit 1
- ;;
- metadata/*cache*)
- echo "*** Metadata Cache is not allowed in the repository"
- exit 1
- ;;
- metadata/glsa*)
- echo "*** GLSAs are not allowed in the repository"
- exit 1
- ;;
- metadata/news*)
- echo "*** News is not allowed in the repository"
- exit 1
- ;;
- metadata/herds.xml|metadata/dtd*|metadata/timestamp*)
- echo "*** Metadata is not allowed in the repository"
- exit 1
- ;;
- esac
- done
-
- # verify that everything on the left-hand side of commit history is signed
- # (further branches of merges can be unsigned)
- revs=$(git rev-list --first-parent "${newrev}" "^${oldrev}")
- for r in ${revs}; do
- signst=$(git show -q --pretty=format:'%G?' "${r}")
- case ${signst} in
- G)
- ;;
- U)
- echo "*** Untrusted signature on ${r}, refusing"
- exit 1
- ;;
- B)
- echo "*** Bad signature on ${r}, refusing"
- exit 1
- ;;
- N)
- echo "*** No signature on ${r}, refusing"
- exit 1
- ;;
- *)
- echo "*** Unknown signature status '${signst}', refusing"
- exit 1
- ;;
- esac
- done
-
- # trigger cache regen
- # TODO: better do this post-update
- kill -HUP "$(cat "${egencached_pidfile}")"
- ;;
- refs/heads/*)
- # dev branches are fine whatever they are
- ;;
- refs/notes/*)
- # allow git notes, why not?
- ;;
- *)
- echo "*** Unknown object refused" >&2
- exit 1
- ;;
-esac
-
-# --- Finished
-exit 0