summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParabola git <git@parabola.nu>2019-11-25 02:00:04 +0000
committerParabola git <git@parabola.nu>2019-11-25 02:00:04 +0000
commitba8e4423f7d389147fe8427c4216e126df8e4967 (patch)
treec64add5e7d9609cdc827f38990ace54ba43bc569
parent7ae3ed56b524d65d00a4e92968e4bd4d373a7de7 (diff)
Update from cron
-rwxr-xr-x.config/git/hooks/post-receive.d/notify-pbot-git-hook24
1 files changed, 13 insertions, 11 deletions
diff --git a/.config/git/hooks/post-receive.d/notify-pbot-git-hook b/.config/git/hooks/post-receive.d/notify-pbot-git-hook
index 929af6a..5100b40 100755
--- a/.config/git/hooks/post-receive.d/notify-pbot-git-hook
+++ b/.config/git/hooks/post-receive.d/notify-pbot-git-hook
@@ -5,9 +5,10 @@
# a559985626bbf4448ccf9041857449078db6d731 1d5002ade3f71200274f1ba39e35a732d86220b5 refs/heads/master
# 0000000000000000000000000000000000000000 1d5002ade3f71200274f1ba39e35a732d86220b5 refs/heads/new-branch
+
## constants ##
readonly LOG_PBOT_GIT_HOOK=1
-readonly LOG_DIR=/var/log/notify-pbot
+readonly LOG_DIR=/var/log/pbot
readonly SHA_REGEX='^([0-9a-f]{40})$'
@@ -23,8 +24,8 @@ LogFile() # (repo ref)
LogParseRefDataIn() # (ref_data prev_sha curr_sha ref_file repo ref is_deletion)
{
- local ref_data=$1 ; local prev_sha=$2 ; local curr_sha=$3 ;
- local ref_file=$4 ; local repo=$5 ; local ref=$6 ; local is_deletion=$7 ;
+ local ref_data=$1 ; local prev_sha=$2 ; local curr_sha=$3 ; local ref_file=$4 ;
+ local repo=$5 ; local ref=$6 ; local is_deletion=$7 ;
local log_file=$(LogFile ${repo} ${ref})
(( $LOG_PBOT_GIT_HOOK )) && echo "ref_data=${ref_data}" > ${log_file} && \
@@ -41,13 +42,13 @@ LogParseRefDataOut() # (hacker author log_msg n_behind n_ahead n_total repo ref)
local n_ahead=$5 ; local n_total=$6 ; local repo=$7 ; local ref=$8 ;
local log_file=$(LogFile ${repo} ${ref})
- (( $LOG_PBOT_GIT_HOOK )) && echo "hacker=${hacker}" >> ${log_file} && \
- echo "author=${author}" >> ${log_file} && \
- echo "log_msg=${log_msg}" >> ${log_file} && \
- echo "n_behind=${n_behind}" >> ${log_file} && \
- echo "n_ahead=${n_ahead}" >> ${log_file} && \
- echo "n_total=${n_total}" >> ${log_file} && \
- echo "repo=${repo}" >> ${log_file}
+ (( $LOG_PBOT_GIT_HOOK )) && echo "hacker=${hacker}" >> ${log_file} && \
+ echo "author=${author}" >> ${log_file} && \
+ echo "log_msg=${log_msg}" >> ${log_file} && \
+ echo "n_behind=${n_behind}" >> ${log_file} && \
+ echo "n_ahead=${n_ahead}" >> ${log_file} && \
+ echo "n_total=${n_total}" >> ${log_file} && \
+ echo "repo=${repo}" >> ${log_file}
}
@@ -71,7 +72,8 @@ ParseRefData() # (prev_sha curr_sha ref_file)
[[ "${ref}" ]] || return
# collect push details
- local hacker=$( /usr/lib/parabola-hackers/last-hacker-login )
+# local hacker=$( /usr/lib/parabola-hackers/last-hacker-login )
+ local hacker=''
local author="$( git log -1 --format='%an' ${curr} )"
local log_msg="$(git log -1 --format='%s' ${curr} )"
local n_behind=$(git rev-list --count ${curr}..${prev} 2> /dev/null)