Skip to content

Commit a636595

Browse files
committed
Make sure hook runs in the root directory
1 parent 7d8c93e commit a636595

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hooks/update

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Hook script to validate rules and check locales before accepting
44
# pushed changes on the server side.
55
# See http://stackoverflow.com/questions/4541417/how-can-i-make-it-so-git-rejects-pushing-code-that-wont-compile
6+
#
7+
# By default, this should run in the root of the git repository.
68

79
# --- Command line
810
refname="$1"
@@ -24,7 +26,9 @@ fi
2426

2527
# --- Copy the state of the repository as of the new pushed code
2628

27-
copydir = "./tmp/git_hook_compile_copy"
29+
maindir=$(git rev-parse --show-toplevel)
30+
cd "$maindir"
31+
copydir="./tmp/git_hook_compile_copy"
2832

2933
echo "making copy of $newrev to $copydir" >&2
3034
rm -rf "$copydir"

0 commit comments

Comments
 (0)