From d207a67c6e12b50ea2234451d40ffe959fff1287 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 2 Feb 2024 13:45:35 +0100 Subject: [PATCH] =?UTF-8?q?MT#59308=20commit:=20Include=20reason=20in=20?= =?UTF-8?q?=C2=ABngcpcfg=20apply=C2=BB=20commit=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When doing an «ngcpcfg apply» we are required to pass a reason for it which might be included in a «git commit», but not in the etckeeper commit. Modify the wording for the latter, and include that reason so that the git history makes more sense and is more traceable. So when executing: # ngcpcfg apply "Fix array in component B" The git commit message looked before like: ngcpcfg apply And now it will look like Fix array in component B via "ngcpcfg apply" Change-Id: Ib7b4ce986366ca51a487a087cb327b0d0dfe1ccd --- scripts/commit | 2 +- scripts/etckeeper | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/commit b/scripts/commit index bf2ab137..0268cc6e 100755 --- a/scripts/commit +++ b/scripts/commit @@ -88,7 +88,7 @@ else fi log_debug "${SCRIPTS}/etckeeper" -"${SCRIPTS}"/etckeeper >/dev/null +"${SCRIPTS}"/etckeeper "$msg" >/dev/null if [ -z "${NO_DB_SYNC:-}" ] ; then log_info "Synchronizing MySQL grants/credentials" diff --git a/scripts/etckeeper b/scripts/etckeeper index f0d1235b..fef47e99 100755 --- a/scripts/etckeeper +++ b/scripts/etckeeper @@ -35,12 +35,19 @@ if ! [ -d .git ] ; then exit 0 fi +# commit message +if [ -z "${1:-}" ] ; then + msg="committing uncommented changes" +else + msg="$*" +fi + log_info "Checking state of ${NGCPCTL_BASE} files" if is_git_clean ; then log_info "OK: nothing to commit." else - log_debug "etckeeper commit \"ngcpcfg apply\"" - etckeeper commit "ngcpcfg apply" | sed "s/^/$timestamp_replacementchars/" + log_debug "etckeeper commit '$msg via \"ngcpcfg apply\"'" + etckeeper commit "$msg via \"ngcpcfg apply\"" | sed "s/^/$timestamp_replacementchars/" fi ## END OF FILE #################################################################