From a58e66bc9c96c90dbc5a49f123391ef7f19a1495 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 2 Feb 2024 13:31:03 +0100 Subject: [PATCH] MT#59308 commit: Do not include the date in the commit message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The date is already tracked as part of the commit metadata, and we use the current day which will always match the author date for the commit, so no information is lost. This makes the commit message more clear and removes redundant and distracting information from it. For «ngcpcfg log» we include the date from the commit metadata explicitly in the output, which will be duplicated for old entries but gets it from where it belongs for new ones. (Even though the date is also printed in relative terms on the front of the line.) We now get this output for old and new entries: * b3767f6 (10 hours ago) new [2024-02-02 14:28:11 +0100] (HEAD -> master) * dc0a310 (3 days ago) old [2024-01-30 23:10:32.674452749+01:00] [2024-01-30 23:10:32 +0100] Change-Id: I4eb4faed433db52e6755bc7782ec34545741d452 --- scripts/commit | 4 ++-- scripts/etckeeper | 4 ++-- scripts/log | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/commit b/scripts/commit index 44688746..bf2ab137 100755 --- a/scripts/commit +++ b/scripts/commit @@ -81,9 +81,9 @@ if is_git_clean ; then log_info "OK: nothing to commit." else log_debug "msg:\"$msg\"" - log_debug "git add . ; git commit -a -m \"\$msg [\$(date --rfc-3339=ns)]\"" + log_debug "git add . ; git commit -a -m \"\$msg\"" git add . - git commit -a -m "$msg [$(date --rfc-3339=ns)]" >/dev/null + git commit -a -m "$msg" >/dev/null log_info "OK" fi diff --git a/scripts/etckeeper b/scripts/etckeeper index 268a8677..f0d1235b 100755 --- a/scripts/etckeeper +++ b/scripts/etckeeper @@ -39,8 +39,8 @@ 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 on \$(date)\"" - etckeeper commit "ngcpcfg apply on $(date)" | sed "s/^/$timestamp_replacementchars/" + log_debug "etckeeper commit \"ngcpcfg apply\"" + etckeeper commit "ngcpcfg apply" | sed "s/^/$timestamp_replacementchars/" fi ## END OF FILE ################################################################# diff --git a/scripts/log b/scripts/log index bd498c8a..59780611 100755 --- a/scripts/log +++ b/scripts/log @@ -26,11 +26,11 @@ if [ -f "${FUNCTIONS}/ha_features" ] ; then exit 1 fi - git log "$@" --oneline --date-order --graph --date=rfc --format=format:"%h (%ar) %s %d" master origin/master + git log "$@" --oneline --date-order --graph --date=rfc --format=format:"%h (%ar) %s [%ai] %d" master origin/master else - git log "$@" --oneline --date-order --graph --date=rfc --format=format:"%h (%ar) %s %d" master + git log "$@" --oneline --date-order --graph --date=rfc --format=format:"%h (%ar) %s [%ai] %d" master fi