summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar steering72532026-05-22 03:39:13 -0600
committerGravatar steering72532026-05-22 03:39:13 -0600
commitb0cf9cdde04d899fe933d3f09ea51f87d648b7fb (patch)
tree66eb6696b15a34941a960aa180903e19602e909d
parentadd hooks.notify (diff)
add config setting to suppress notifications and limit notifications to last 9 commits
-rwxr-xr-xupdate33
1 files changed, 18 insertions, 15 deletions
diff --git a/update b/update
index 330c103..7af934d 100755
--- a/update
+++ b/update
@@ -17,6 +17,7 @@ ref="$1"
old="$2"
new="$3"
+suppress="$(git config --get --type bool --default=false hooks.suppressNotify)"
allowForcePush="$(git config --type=bool hooks.allowForcePush)"
protectedRefs="$(git config --default "$default_branch_path" hooks.protectedRefs)"
addlNotify="$(git config get --value '^([a-zA-Z0-9_.-]+|[0-9.]+|[0-9a-fA-F:.]+):[0-9]{1,5}$' hooks.notify)"
@@ -39,23 +40,25 @@ else # commit --amend, rebase, or similar
fi
#curl -sS -d "[$reponame] $ref $commits" "$H2I" >/dev/null
-echo "[$reponame] $ref $commits by $USER" | "${NC[@]}" "${to_host:-127.0.0.1}" "${to_port:-1337}" >/dev/null
-if [ -n "$addlNotify" ]; then
- echo "[$reponame] $ref $commits by $USER" | "${NC[@]}" "${addlNotify%:*}" "${addlNotify##*:}" >/dev/null
-fi
+if [ "$suppress" != "true" ]; then
+ echo "[$reponame] $ref $commits by $USER" | "${NC[@]}" "${to_host:-127.0.0.1}" "${to_port:-1337}" >/dev/null
+ if [ -n "$addlNotify" ]; then
+ echo "[$reponame] $ref $commits by $USER" | "${NC[@]}" "${addlNotify%:*}" "${addlNotify##*:}" >/dev/null
+ fi
-if ((16#$old == 0)); then
- git log --no-show-signature --no-patch --pretty="tformat:$FORMAT" "$new"
-else
- git log --no-show-signature --pretty="tformat:$FORMAT" "$old".."$new"
-fi | while read line; do
- : #curl -sS -d "$line" "$H2I" >/dev/null
- echo "$line" | "${NC[@]}" "${to_host:-127.0.0.1}" "${to_port:-1337}" >/dev/null
+ if ((16#$old == 0)); then
+ git log --no-show-signature --no-patch --pretty="tformat:$FORMAT" "$new" | head -9
+ else
+ git log --no-show-signature --pretty="tformat:$FORMAT" "$old".."$new"
+ fi | while read line; do
+ : #curl -sS -d "$line" "$H2I" >/dev/null
+ echo "$line" | "${NC[@]}" "${to_host:-127.0.0.1}" "${to_port:-1337}" >/dev/null
- if [ -n "$addlNotify" ]; then
- echo "$line" | "${NC[@]}" "${addlNotify%:*}" "${addlNotify##*:}"
- fi
-done
+ if [ -n "$addlNotify" ]; then
+ echo "$line" | "${NC[@]}" "${addlNotify%:*}" "${addlNotify##*:}"
+ fi
+ done
+fi
if [[ $forced == "true" && $allowForcePush != "true" && $ref =~ $protectedRefs ]]; then
echo "(BLOCKED PUSH, 'git config hooks.allowForcePush true' on server to allow)" | "${NC[@]}" "${to_host:-127.0.0.1}" "${to_port:-1337}" >/dev/null