From 444861f01377ca0b6912d725a0c7aae108130f1a Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Thu, 24 Oct 2024 00:12:45 +0200 Subject: [PATCH] skip asking if w-i-p should be pushed if the lockfile exists --- .githooks/pre-push | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index f4361da..46c0863 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -2,14 +2,15 @@ wips=$(git log --oneline --no-decorate | grep -i wip ) wips_n=$(echo "$wips" | wc -l) +LOCKFILE=/tmp/githook.allow_wip -if [[ -n "$wips" ]]; then +if [[ -f $LOCKFILE && -n "$wips" ]]; then # Allows us to read user input below, assigns stdin to keyboard exec < /dev/tty echo "contains $wips_n WIP commit(s)" read -p "Really push? (Y/N) " -n 1 -r case "$REPLY" in - y|Y ) echo -e "\ncontinuing...";; + y|Y ) echo -e "\ncontinuing..."; touch $LOCKFILE;; * ) echo -e "\naborting."; exit 1;; esac fi