Setup
etckeeper version:
etckeeper/stable,stable,now 1.18.16-1 all [residual-config]
Environment:
Linux Debian-1101-bullseye-amd64-base 5.10.0-9-amd64
Installed via apt install etckeeper on Debian 11 Bullseye, so using Debian's https://packages.debian.org/bullseye/etckeeper.
In case only downstream Debian is the culprit, sorry for reporting here and not downstream - but Debian's bugtracker is so awful to use ...
Issue
Despite /etc/etckeeper/etckeeper.conf being configured with VCS="hg", the moment a git directory /etc/.git/ (and/or file /etc/.gitignore?) exists, etckeeper will use git (and e.g. .gitignore instead of .hgignore). Maybe this issue is not limited to Mercurial/hg only, but affects any other VCS (mercurial, bazaar, or darcs) as well.
My scenario
I noticed this issue as I wanted to set up etckeeper with Mercurial while still being able to use my own git-managed /etc hierarchy in parallel: use etckeeper to version/backup all /etc files and at the same time have an additional git repository for cherry-picked etc files: etckeeper tracks all files including my custom conf.d/ etc files and package-provided vanilla files; my additional git repository only tracks my custom conf.d/ etc files. Unfortunately, it's not possible to have two git repositories in the same directory (here /etc) due to a git repository's .gitignore location not being configurable, hence my unsuccessful workaround with etckeeper to use hg/Mercurial.
We can see why right in /usr/bin/etckeeper:
So the VCS config is only used to control what
etckeeper initdoes.See also this todo item about it, with more discussion: ?strong>VCS
Thank your for the info, I found your mentioned TODO at Give preference to etckeeper.conf over existing repository for defining $VCS.
I was able to accomplish my scenario (one personal git repository with
cherry-pickedselected configuration files in one repository AND using etckeeper as well) with the following workaround setup:/.I noticed that (at least in Debian 11.2 bullseye)
apt install etckeeperautomatically runsetckeeper init, thereby setting up a git-based etckeeper according to the defaultetckeeper.conffile - but I want hg. I looked around, but there doesn't currently seem to be a way (e.g. debconf) to configure etckeeper at pre-installation time to use hg other than having an appropriate/etc/etckeeper/etckeeper.conffile in place before runningapt install etckeeper. Or is there? Thanks for your help!