I'm using etckeeper with hg and I will use git to manage some files under /etc apart from etckeeper for some reason.
However, after I initialize new git repository as /etc/.git, etckeeper starts to use git as $VCS contrary to definition in etckeeper.conf. So I think that definition in etckeeper.conf should be given priority over existing repository.
The patch is below (from https://github.com/hiraku/etckeeper/commit/02f6d37e50cacddc9605dcbc5c8844b3f4658d6e ):
diff --git a/etckeeper b/etckeeper
index 93f2b00..6c63ffb 100755
--- a/etckeeper
+++ b/etckeeper
@@ -109,14 +109,16 @@ fi
cd "$ETCKEEPER_DIR"
export ETCKEEPER_DIR
-if [ -d ".git" ]; then
- VCS=git
-elif [ -d ".hg" ]; then
- VCS=hg
-elif [ -d "_darcs" ]; then
- VCS=darcs
-elif [ -d ".bzr" ]; then
- VCS=bzr
+if [ -z "$VCS" ]; then
+ if [ -d ".git" ]; then
+ VCS=git
+ elif [ -d ".hg" ]; then
+ VCS=hg
+ elif [ -d "_darcs" ]; then
+ VCS=darcs
+ elif [ -d ".bzr" ]; then
+ VCS=bzr
+ fi
fi
if [ -z "$VCS" ]; then
I would appreciate your consideration.
Thank you.
I'm not thrilled by this idea. It's not uncommon for etckeeper.conf to be packaged by a distribution. Upgrading the package may replace the local etckeeper.conf (takes only answering "Y" on debian). If that changes out the VCS setting, then etckeeper suddently stops using the repository it was using.
The README documents how to change the VCS that etckeeper uses. So I think it would be better to document that VCS setting in etckeeper.conf only applies to
etckeeper init
. Or alternatively, to add a parameter likeetckeeper init --vcs=git
.It's true that neither of those options would cater to a system that has two different version control repositories checked out in /etc at the same time, but that sounds like a sufficiently strange/bad idea that I see no reason to cater to it.