diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-09-07 14:24:52 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-09-07 14:24:52 -0400 |
commit | 0b30c92649cdb55996fb20fc2782476f6fab146a (patch) | |
tree | cfb173e849dc6d8b52d7a13cbd148228cf3a59da /init.d/50vcs-pre-commit-hook | |
parent | dd45df9d9209f2f47042e76c32476a21884b7c52 (diff) |
Fix hgrc setup code to not warn if the hgrc already contains a call to etckeeper. (Thanks, Jakov Sosic)
Diffstat (limited to 'init.d/50vcs-pre-commit-hook')
-rwxr-xr-x | init.d/50vcs-pre-commit-hook | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/init.d/50vcs-pre-commit-hook b/init.d/50vcs-pre-commit-hook index 06d433b..e1745b1 100755 --- a/init.d/50vcs-pre-commit-hook +++ b/init.d/50vcs-pre-commit-hook @@ -19,10 +19,12 @@ EOF ;; hg) 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 -d `pwd`" >&2 + if ! grep -q "etckeeper pre-commit" .hg/hgrc; then + echo "etckeeper warning: [hooks] section in .hg/hgrc needs to be manually modified to run: etckeeper pre-commit -d `pwd`" >&2 + fi else - touch .hg/hgrc - cat >>.hg/hgrc <<EOF + touch .hg/hgrc + cat >>.hg/hgrc <<EOF [hooks] # pre-commit hook for etckeeper, to store metadata and do sanity checks precommit = etckeeper pre-commit -d `pwd` |