summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2023-05-04 09:22:40 -0700
committerJim Porter <jporterbugs@gmail.com>2023-05-04 09:22:40 -0700
commitd3ec68f5e433e5792c1c63672c7b437bb29c5759 (patch)
treed28fcb52c8a7b1b64d04c36a86fc6d2c56ee272d /build-aux
parentb28d44d4226497c4b2582bc15a59fc817eb3ce0a (diff)
downloademacs-d3ec68f5e433e5792c1c63672c7b437bb29c5759.tar.gz
; Fix post-commit and pre-push hooks in worktrees again
* build-aux/git-hooks/post-commit: * build-aux/git-hooks/pre-push: Use "$(dirname $0)" to get the hooks directory.
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/git-hooks/post-commit4
-rwxr-xr-xbuild-aux/git-hooks/pre-push4
2 files changed, 6 insertions, 2 deletions
diff --git a/build-aux/git-hooks/post-commit b/build-aux/git-hooks/post-commit
index 05f2d778b5c..10f43b539ac 100755
--- a/build-aux/git-hooks/post-commit
+++ b/build-aux/git-hooks/post-commit
@@ -34,6 +34,8 @@
### Code:
+HOOKS_DIR=$(dirname $0)
+
# Prefer gawk if available, as it handles NUL bytes properly.
if type gawk >/dev/null 2>&1; then
awk="gawk"
@@ -42,4 +44,4 @@ else
fi
git rev-parse HEAD | $awk -v reason=post-commit \
- -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk
+ -f $HOOKS_DIR/commit-msg-files.awk
diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push
index 6ff59102fd7..8d5dde2bbaf 100755
--- a/build-aux/git-hooks/pre-push
+++ b/build-aux/git-hooks/pre-push
@@ -31,6 +31,8 @@
### Code:
+HOOKS_DIR=$(dirname $0)
+
# Prefer gawk if available, as it handles NUL bytes properly.
if type gawk >/dev/null 2>&1; then
awk="gawk"
@@ -83,4 +85,4 @@ $awk -v origin_name="$1" '
# Print every SHA after oldref, up to (and including) newref.
system("git rev-list --first-parent --reverse " oldref ".." newref)
}
-' | $awk -v reason=pre-push -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk
+' | $awk -v reason=pre-push -f $HOOKS_DIR/commit-msg-files.awk