From 69fad2a2196eedff5b2274a75964e2810dc3f1b0 Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Mon, 29 Jan 2024 17:28:19 +0100 Subject: [PATCH] [git-hook] Use git to retrieve root path --- dev/git-hooks/pre-commit.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/git-hooks/pre-commit.sh b/dev/git-hooks/pre-commit.sh index 9225fe93451..5333e2b62eb 100755 --- a/dev/git-hooks/pre-commit.sh +++ b/dev/git-hooks/pre-commit.sh @@ -23,8 +23,8 @@ # Example of installation of this pre-commit hook (client side): # - (cd .git/hooks/ && ln -s ../../dev/git-hooks/pre-commit.sh pre-commit) -# Note: if you decide to copy the file, the `SCRIPT_DIR` variable must be -# fixed accordingly. + +ROOT=$(git rev-parse --show-toplevel) echo "Pre-commit Hook..." @@ -36,5 +36,4 @@ then exit 0 fi -SCRIPT_DIR=$(dirname -- "$( readlink -f -- "$0"; )") -"$SCRIPT_DIR/../check-files.sh" -c || exit 1 +"$ROOT/dev/check-files.sh" -c || exit 1 -- GitLab