diff --git a/cmd/templates/hook.tmpl b/cmd/templates/hook.tmpl index 4648b028..ffc0738c 100644 --- a/cmd/templates/hook.tmpl +++ b/cmd/templates/hook.tmpl @@ -8,7 +8,7 @@ if [ -t 1 ] ; then exec < /dev/tty ; # <- enables interactive shell fi -dir="$(cd "$(dirname "$(dirname "$(dirname "$0")")")" >/dev/null 2>&1 || exit ; pwd -P)" +dir="$(git rev-parse --show-toplevel)" call_lefthook() { diff --git a/spec/fixtures/pre-commit b/spec/fixtures/pre-commit index 3d435141..53e4d47c 100644 --- a/spec/fixtures/pre-commit +++ b/spec/fixtures/pre-commit @@ -8,7 +8,7 @@ if [ -t 1 ] ; then exec < /dev/tty ; # <- enables interactive shell fi -dir="$(cd "$(dirname "$(dirname "$(dirname "$0")")")" >/dev/null 2>&1 || exit ; pwd -P)" +dir="$(git rev-parse --show-toplevel)" call_lefthook() { diff --git a/spec/fixtures/pre-push b/spec/fixtures/pre-push index 34d0b46b..2dcb5124 100644 --- a/spec/fixtures/pre-push +++ b/spec/fixtures/pre-push @@ -8,7 +8,7 @@ if [ -t 1 ] ; then exec < /dev/tty ; # <- enables interactive shell fi -dir="$(cd "$(dirname "$(dirname "$(dirname "$0")")")" >/dev/null 2>&1 || exit ; pwd -P)" +dir="$(git rev-parse --show-toplevel)" call_lefthook() {