add cron powered poor-man's git hook
This commit is contained in:
parent
e580c679cb
commit
9f965c1121
23
doktor-cron-poorman-githook.sh
Normal file
23
doktor-cron-poorman-githook.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
/usr/bin/git fetch
|
||||
|
||||
UPSTREAM=${1:-'@{u}'}
|
||||
LOCAL=$(/usr/bin/git rev-parse @)
|
||||
REMOTE=$(/usr/bin/git rev-parse "$UPSTREAM")
|
||||
BASE=$(/usr/bin/git merge-base @ "$UPSTREAM")
|
||||
|
||||
if [ $LOCAL = $REMOTE ]; then
|
||||
echo "Up-to-date"
|
||||
elif [ $LOCAL = $BASE ]; then
|
||||
echo "Need to pull"
|
||||
|
||||
#########
|
||||
# AD YOUR MADNESS HERE! SKY IS THE LIMIT
|
||||
#########
|
||||
|
||||
elif [ $REMOTE = $BASE ]; then
|
||||
echo "Need to push"
|
||||
else
|
||||
echo "Diverged"
|
||||
fi
|
Loading…
Reference in a new issue