summaryrefslogtreecommitdiff
path: root/hg/init.d/50hg-pre-commit-hook
diff options
context:
space:
mode:
Diffstat (limited to 'hg/init.d/50hg-pre-commit-hook')
-rw-r--r--hg/init.d/50hg-pre-commit-hook15
1 files changed, 6 insertions, 9 deletions
diff --git a/hg/init.d/50hg-pre-commit-hook b/hg/init.d/50hg-pre-commit-hook
index 0efd5e4..0603d30 100644
--- a/hg/init.d/50hg-pre-commit-hook
+++ b/hg/init.d/50hg-pre-commit-hook
@@ -1,15 +1,12 @@
#!/bin/sh
set -e
-if [ -x .git/hooks/pre-commit ]; then
- if ! grep -q "etckeeper pre-commit" .git/hooks/pre-commit; then
- echo "etckeeper warning: .git/hooks/pre-commit needs to be manually modifed to run: etckeeper pre-commit `pwd`" >&2
- fi
+if [ -e .hg/hgrc ] && grep "^\[hooks\]" .hg/hgrc; then
+ echo "etckeeper warning: [hooks] section in .hg/hgrc needs to be manually modified to run: etckeeper pre-commit `pwd`" >&2
else
- cat >.git/hooks/pre-commit <<EOF
-#!/bin/sh
+ touch
+ cat >>.hg/hgrc <<EOF
+[hooks]
# pre-commit hook for etckeeper, to store metadata and do sanity checks
-set -e
-etckeeper pre-commit `pwd`
+precommit = etckeeper pre-commit `pwd`
EOF
- chmod +x .git/hooks/pre-commit
fi