void- enter the void 🪐 |
git clone git://git.acid.vegas/archlinux.git |
Log | Files | Refs | Archive |
irc-post-commit-hook (1267B)
1 #!/bin/sh 2 # irc post-commit hook - developed by acidvegas (https://git.acid.vegas/void) 3 4 # Place this file in .git/hooks/post-commit and chmod +x 5 6 # Configuration 7 WEECHAT_NETWORK="irc.supernets.org" 8 WEECHAT_CHANNEL="#dev" 9 WEECHAT_FIFO="/home/acidvegas/.local/share/weechat/weechat_fifo" 10 SSH_SERVER="war" 11 12 # Get commit data for the message 13 _data=$(git log -1 --graph --pretty=format:"%h|%s|%cn") 14 _hash=$(echo "$_data" | cut -d'|' -f1 | cut -c 3-) 15 _msg=$(echo "$_data" | cut -d'|' -f2) 16 _name=$(echo "$_data" | cut -d'|' -f3) 17 #_name=$(basename $(dirname $(git rev-parse --show-toplevel))) # For locally parsing organization names 18 _repo=$(basename -s .git $(git config --get remote.origin.url)) 19 _summary=$(git show $_hash --stat | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {printf "%s|+%s|-%s", files, inserted, deleted }') 20 _files=$(echo $_summary | cut -d'|' -f1) 21 _inserts=$(echo $_summary | cut -d'|' -f2) 22 _deletes=$(echo $_summary | cut -d'|' -f3) 23 _ircmsg="irc.$WEECHAT_NETWORK.$WEECHAT_CHANNEL *^C14[^C11GitHub^C14]^O Commit pushed to ^C08$_name/$_repo^O (^C06$_hash^O) ^C14[^O$_files^C14|^C03$_inserts^C14|^C04$_deletes^C14]^O : $_msg" 24 25 # Send the message to weechat 26 echo "$_ircmsg" | ssh $SSH_SERVER tee $WEECHAT_FIFO > /dev/null