home/.githooks/pre-push

16 lines
388 B
Plaintext
Raw Normal View History

2024-10-23 23:32:12 +02:00
#!/bin/bash
wips=$(git log --oneline --no-decorate | grep -i wip )
2024-10-23 23:54:46 +02:00
wips_n=$(echo "$wips" | wc -l)
2024-10-23 23:32:12 +02:00
if [[ -n "$wips" ]]; then
# Allows us to read user input below, assigns stdin to keyboard
exec < /dev/tty
2024-10-23 23:54:46 +02:00
echo "contains $wips_n WIP commit(s)"
read -p "Really push? (Y/N) " -n 1 -r
case "$REPLY" in
y|Y ) echo -e "\ncontinuing...";;
* ) echo -e "\naborting."; exit 1;;
2024-10-23 23:32:12 +02:00
esac
fi