I would like to make clean commits with etckeeper. Here is what happens:
1) Check the status of the repository :
git status On branch master nothing to commit, working directory clean
2) Modify a configuration file :
vi myfile.conf
3) Add it to the index
git add myfile.conf
4) Make a commit
git commit -m"Add this ... to myfile.conf"
5) Observe the commit :
git log -p -1 [...] maybe chmod 0644 'magic.mime' -maybe chmod 0644 'mail.rc' maybe chmod 0644 'mailcap' maybe chmod 0644 'mailcap.order' maybe chmod 0644 'mailname' +maybe chmod 0644 'mail.rc' maybe chmod 0644 'manpath.config' maybe chmod 0644 'matplotlibrc' maybe chmod 0755 'maven' [...] (My modification to myfile.conf) [...]
I understand that etckeeper need to keep track of file permissions in the git repository even if I don’t understand the purpose of this reordering. I would like to separate in distinct commits all modifications related to the
./etckeeper
directory and modifications related to the content of the configuration files.How to do it?
Answer
Etckeeper sets up a git hook to commit the file containing metadata information whenever metadata changes. This is usually the right thing. If you really want to bypass the commit hook, you can run git commit --no-verify
.
The metadata file is sorted by file name. The sorting order depends on the ambient locale. In your case, the file appears to have been sorted in a pure byte lexicographic order (with mail.rc
before mailcap
since .
is before c
in ASCII), but you are now running git in a locale where sorting is done in a somewhat human-friendly way, with punctuation ignored except as a last resort (probably a UTF-8 locale) (with mail.rc
after mailname
since n
is before r
). Run LC_ALL=C git commit
to do the sorting in pure lexicographic order. It would make sence to add export LC_COLLATE=C
to /etc/etckeeper/etckeeper.conf
to force a consistent sorting order.
Attribution
Source : Link , Question Author : Ortomala Lokni , Answer Author : Gilles ‘SO- stop being evil’