summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-05 17:30:39 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-05 17:30:39 -0500
commitf0522c931958b7dccca733229254f2e37f0ef20c (patch)
tree01c3964078b47200e3d624dccd3dafa10d18311f
parentc01f3fe97eadce94a2f37908dc57f54d9af5b25a (diff)
support git commit being run in a subdir
Store the toplevel directory of the repo in the pre-commit hook, and cd to there. This is not ideal, but good enough.
-rwxr-xr-xetckeeper2
-rwxr-xr-xinit.d/40git-pre-commit-hook2
2 files changed, 3 insertions, 1 deletions
diff --git a/etckeeper b/etckeeper
index 9550311..c05845d 100755
--- a/etckeeper
+++ b/etckeeper
@@ -19,6 +19,8 @@ fi
if [ "$command" = post-apt ] || [ "$command" = pre-apt ]; then
cd /etc
+elif [ "$command" = pre-commit ]; then
+ chdir "$1"
fi
run-parts "/etc/etckeeper/$command.d"
diff --git a/init.d/40git-pre-commit-hook b/init.d/40git-pre-commit-hook
index cf96c1e..88eb581 100755
--- a/init.d/40git-pre-commit-hook
+++ b/init.d/40git-pre-commit-hook
@@ -10,7 +10,7 @@ else
# pre-commit hook for etckeeper. Calls etckeeper-pre-commit to store metadata
# and do sanity checks.
set -e
-etckeeper-pre-commit
+etckeeper-pre-commit `pwd`
EOF
chmod +x .git/hooks/pre-commit
fi