diff options
author | Parabola git <git@parabola.nu> | 2020-03-12 19:00:01 +0000 |
---|---|---|
committer | Parabola git <git@parabola.nu> | 2020-03-12 19:00:01 +0000 |
commit | ec5ea2e1b3e8c6f4b47c2b8804701929724d6fcf (patch) | |
tree | 3a08d2bf7b2ed19398021aa9b2b7430ac1792e35 | |
parent | 02870d05694a45620fc19b7710feeb059c1e242e (diff) |
Update from cron
-rwxr-xr-x | abslibre/blacklist.git/hooks/pre-receive | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/abslibre/blacklist.git/hooks/pre-receive b/abslibre/blacklist.git/hooks/pre-receive index ff70f9c..5a9fdef 100755 --- a/abslibre/blacklist.git/hooks/pre-receive +++ b/abslibre/blacklist.git/hooks/pre-receive @@ -9,6 +9,7 @@ ## constants ## readonly LOG_BLACKLIST_GIT_HOOK=1 +readonly CLONE_DIR=/home/autobuilder/blacklist readonly LOG_DIR=/var/log/blacklist-validate-git-hook readonly SHA_REGEX='^([0-9a-f]{40})$' @@ -42,7 +43,7 @@ cat $log_file ## helpers ## -ParseRefData() # (prev_sha curr_sha ref_file) +HandleRefData() # (prev_sha curr_sha ref_file) { local prev_sha=$1 local curr_sha=$2 @@ -57,15 +58,30 @@ LogParseRefData "${ref_data}" ${prev_sha} ${curr_sha} ${ref_file} ${repo} ${ref} [[ "$#" == '3' ]] && \ [[ "${prev_sha}" =~ ${SHA_REGEX} ]] && \ [[ "${curr_sha}" =~ ${SHA_REGEX} ]] && \ - [[ "${ref}" ]] || return - - local tmp_dir=$(mktemp --directory --tmpdir=/tmp blacklist-validate-git-hook-XXXXXXXXXX) + [[ "${ref}" ]] || return 1 + + (( ! ${is_deletion} )) || return 0 + + [[ -f ${CLONE_DIR}/blacklist.txt ]] || return 1 + + cd ${CLONE_DIR} +# local tmp_dir=$(mktemp --directory --tmpdir=/tmp blacklist-validate-git-hook-XXXXXXXXXX) +#pwd +# git clone --no-hardlinks $(pwd) ${tmp_dir} +# cd ${tmp_dir} +#GIT_WORK_TREE=/srv/git/abslibre/blacklist.git git fetch local-git-home + + +# git checkout -b validate ${curr_sha} +#git branch +pwd ; ls -al +# rm -rf ${tmp_dir} echo "ok tmp_dir=$tmp_dir" } ## main entry ## -while read ref_data ; do echo "$(ParseRefData ${ref_data})" || exit 1 ; done ; +while read ref_data ; do HandleRefData ${ref_data} || exit 1 ; done ; #while read ref_data ; do echo "refdata=${ref_data}" || exit 1 ; done ; exit 1 |