From c241963f566dc7e168338424b7631112e791ee16 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 30 Jan 2025 09:18:57 +0100 Subject: [PATCH] dont always do git lfs --- .githooks/post-checkout | 3 --- .githooks/post-commit | 3 --- .githooks/post-merge | 3 --- .githooks/pre-push | 23 ++++++++++------------- 4 files changed, 10 insertions(+), 22 deletions(-) delete mode 100755 .githooks/post-checkout delete mode 100755 .githooks/post-commit delete mode 100755 .githooks/post-merge diff --git a/.githooks/post-checkout b/.githooks/post-checkout deleted file mode 100755 index cab40f2..0000000 --- a/.githooks/post-checkout +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; } -git lfs post-checkout "$@" diff --git a/.githooks/post-commit b/.githooks/post-commit deleted file mode 100755 index 9443f41..0000000 --- a/.githooks/post-commit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; } -git lfs post-commit "$@" diff --git a/.githooks/post-merge b/.githooks/post-merge deleted file mode 100755 index 828b708..0000000 --- a/.githooks/post-merge +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; } -git lfs post-merge "$@" diff --git a/.githooks/pre-push b/.githooks/pre-push index a0116db..33e045c 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -2,19 +2,16 @@ # check for WIP commits wips=$(git log --oneline --no-decorate | grep -i wip ) wips_n=$(echo "$wips" | wc -l) -LOCKFILE=/tmp/githook.allow_wip +LOCKFILE="$PWD/.git/.githook.allow_wip" +# This checks if neither lockfile exists AND wips is non-empty 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..."; touch $LOCKFILE;; - * ) echo -e "\naborting."; exit 1;; - esac + # 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..."; touch $LOCKFILE;; + * ) echo -e "\naborting."; exit 1;; + esac fi - -# git-lfs stuff -command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; } -git lfs pre-push "$@"