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 | 2fe770b7f73948d916b0d77740f69b5d96fed765 (patch) | |
tree | d58286456dfdb3505882c007cd3e8d3ae0ddf3a5 | |
parent | 60350f57bfbca252142b9afb04645bf915b0d8a8 (diff) |
Update from cron
l--------- | abslibre/blacklist.git/hooks/.#pre-receive | 1 | ||||
-rwxr-xr-x | abslibre/blacklist.git/hooks/pre-receive | 26 |
2 files changed, 21 insertions, 6 deletions
diff --git a/abslibre/blacklist.git/hooks/.#pre-receive b/abslibre/blacklist.git/hooks/.#pre-receive deleted file mode 120000 index de68fb9..0000000 --- a/abslibre/blacklist.git/hooks/.#pre-receive +++ /dev/null @@ -1 +0,0 @@ -root@winston.parabola.nu.2349507
\ No newline at end of file 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 |