Package: etckeeper Version: 0.2 Severity: wishlist Tags: patch When etckeeper commit automatically (as in post and pre apt) it would be interesting to be able to edit the commit message to our liking on a per commit basis (as opposed to change the commit message in the /etc/etckeeper/*.d/* file). Join two patch to do it (one by making the change for every body, the other by giving a way to customize it).
-- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (700, 'unstable'), (700, 'stable'), (550, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.23acer (SMP w/1 CPU core; PREEMPT) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages etckeeper depends on: ii debconf [debconf-2.0] 1.5.17 Debian configuration management sy ii git-core 1:1.5.3.5-1 fast, scalable, distributed revisi ii metastore 1 Store and restore metadata etckeeper recommends no packages. -- debconf information excluded
>From b7ceba675af1e6e2d125b454bcfca70f0695a508 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?R=C3=A9mi=20Vanicat?= <[EMAIL PROTECTED]> Date: Tue, 13 Nov 2007 20:17:20 +0100 Subject: [PATCH] Edit commit message before committing When etckeeper commit automatically something (like in pre and post apt), one may want to edit the commit message, so we ask git to launch the editor. --- post-apt.d/50git-commit | 2 +- pre-apt.d/50uncommitted-changes | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/post-apt.d/50git-commit b/post-apt.d/50git-commit index 30ef0f2..a36843c 100755 --- a/post-apt.d/50git-commit +++ b/post-apt.d/50git-commit @@ -6,4 +6,4 @@ set -e message="committing changes after apt run" # ignore exit code since it exits nonzero if there is nothing to do -git commit -m "$message" || true +git commit -e -m "$message" || true diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes index e394db1..8927e74 100755 --- a/pre-apt.d/50uncommitted-changes +++ b/pre-apt.d/50uncommitted-changes @@ -12,7 +12,7 @@ if ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then db_get etckeeper/unclean if [ "$RET" = true ]; then git add . - if ! git commit -m "saving uncommitted changes in /etc prior to apt run"; then + if ! git commit -e -m "saving uncommitted changes in /etc prior to apt run"; then db_input critical etckeeper/commit_failed || true db_go || true db_reset etckeeper/commit_failed || true -- 1.5.3.5
>From 25b5a22419910a85104b808b41069805df8367f6 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?R=C3=A9mi=20Vanicat?= <[EMAIL PROTECTED]> Date: Tue, 13 Nov 2007 20:08:32 +0100 Subject: [PATCH] Render option to git commit configurable When etckeeper commit something it use a default message that can be configured, but not easily edited on a case by case basis. To make this possible, and to give other way to customize commit, I add a configuration file that contain for now only one option: GIT_COMMIT_OPTION that can contain option given to git commit when run by etckeeper --- Makefile | 1 + etckeeper | 8 ++++++++ etckeeper.conf | 5 +++++ post-apt.d/50git-commit | 2 +- pre-apt.d/50uncommitted-changes | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 etckeeper.conf diff --git a/Makefile b/Makefile index 30a60b8..17b49b8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ install: mkdir -p $(PREFIX)/etc/etckeeper/ cp -a *.d $(PREFIX)/etc/etckeeper/ + cp etckeeper.conf $(PREFIX)/etc/etckeeper/ install -D etckeeper $(PREFIX)/usr/bin/etckeeper install -m 0644 -D apt.conf $(PREFIX)/etc/apt/apt.conf.d/05etckeeper install -m 0644 -D etckeeper.1 $(PREFIX)/usr/share/man/man1/etckeeper.1 diff --git a/etckeeper b/etckeeper index 363f706..974ebdc 100755 --- a/etckeeper +++ b/etckeeper @@ -1,6 +1,14 @@ #!/bin/sh set -e +if [ -e /etc/etckeeper/etckeeper.conf ]; then + . /etc/etckeeper/etckeeper.conf +fi + +if [ ! -z "$GIT_COMMIT_OPTION" ] + export GIT_COMMIT_OPTION +fi + if [ -z "$1" ]; then echo "usage: etckeeper command [directory]" >&2 exit 1 diff --git a/etckeeper.conf b/etckeeper.conf new file mode 100644 index 0000000..8c3e5d4 --- /dev/null +++ b/etckeeper.conf @@ -0,0 +1,5 @@ +# GIT_COMMIT_OPTION : option given to git commit when run by etckeeper +# you could for exemple use GIT_COMMIT_OPTION="-e" if you want to edit +# all commit message before commiting + +# GIT_COMMIT_OPTION="" \ No newline at end of file diff --git a/post-apt.d/50git-commit b/post-apt.d/50git-commit index 30ef0f2..6ec8a85 100755 --- a/post-apt.d/50git-commit +++ b/post-apt.d/50git-commit @@ -6,4 +6,4 @@ set -e message="committing changes after apt run" # ignore exit code since it exits nonzero if there is nothing to do -git commit -m "$message" || true +git commit $GIT_COMMIT_OPTION -m $message || true diff --git a/pre-apt.d/50uncommitted-changes b/pre-apt.d/50uncommitted-changes index e394db1..b8b6030 100755 --- a/pre-apt.d/50uncommitted-changes +++ b/pre-apt.d/50uncommitted-changes @@ -12,7 +12,7 @@ if ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then db_get etckeeper/unclean if [ "$RET" = true ]; then git add . - if ! git commit -m "saving uncommitted changes in /etc prior to apt run"; then + if ! git commit $GIT_COMMIT_OPTION -m "saving uncommitted changes in /etc prior to apt run"; then db_input critical etckeeper/commit_failed || true db_go || true db_reset etckeeper/commit_failed || true -- 1.5.3.5