From 0b30c92649cdb55996fb20fc2782476f6fab146a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 7 Sep 2009 14:24:52 -0400 Subject: Fix hgrc setup code to not warn if the hgrc already contains a call to etckeeper. (Thanks, Jakov Sosic) --- debian/changelog | 2 ++ init.d/50vcs-pre-commit-hook | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index fcfd1fc..6afc1c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ etckeeper (0.41) UNRELEASED; urgency=low * Change etckeeper uninit to not remove .gitignore (etc) file if it lacks the "managed by etckeeper" comment. Closes: #545137 + * Fix hgrc setup code to not warn if the hgrc already contains + a call to etckeeper. (Thanks, Jakov Sosic) -- Joey Hess Mon, 07 Sep 2009 14:06:45 -0400 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 <>.hg/hgrc <