From bbecac415e05efde815d020a63398a6923d80af2 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 20 Apr 2021 11:08:29 +0200 Subject: [PATCH] Better information in upgrade_ruleset_version.txt Add commit date so the age of the snapshot is apparent. Add action stamp to get a VCS neutral commit reference. See osdn #42038 --- scripts/revision_describer.bash | 30 +++++++++++++++++++++ tests/rs_test_res/upgrade_ruleset_sync.bash | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 scripts/revision_describer.bash diff --git a/scripts/revision_describer.bash b/scripts/revision_describer.bash new file mode 100755 index 0000000000..223b1668cc --- /dev/null +++ b/scripts/revision_describer.bash @@ -0,0 +1,30 @@ +#!/bin/bash + +if test x$1 = x ; then + REVISION="HEAD" +else + REVISION=$1 +fi + +if test x$2 = x ; then + ONLY_CARE_ABOUT= +else + ONLY_CARE_ABOUT="-- $2" +fi + +FORMAT="%h %cI!%ce %s" +FORMAT="${FORMAT}%n%n" +FORMAT="${FORMAT}commit: %H%n" +FORMAT="${FORMAT}action stamp: %cI!%ce%n" +FORMAT="${FORMAT}author: %aN <%aE>" +FORMAT="${FORMAT} %ai%n" +FORMAT="${FORMAT}committer: %cN <%cE>" +FORMAT="${FORMAT} %ci%n" +FORMAT="${FORMAT}commit message:%n" +FORMAT="${FORMAT}%w(0, 2, 2)%B" + + +git log \ + --format="${FORMAT}" \ + ${REVISION} -1 \ + ${ONLY_CARE_ABOUT} diff --git a/tests/rs_test_res/upgrade_ruleset_sync.bash b/tests/rs_test_res/upgrade_ruleset_sync.bash index 4343bcd5cf..275a3ad2e1 100755 --- a/tests/rs_test_res/upgrade_ruleset_sync.bash +++ b/tests/rs_test_res/upgrade_ruleset_sync.bash @@ -44,5 +44,6 @@ done rm -r ${tmpdir} +DESCRIPTION=`../../scripts/revision_describer.bash ${REVISION} ../../data` echo "Most recent sync from $PREVIOUS_BRANCH" > upgrade_ruleset_version.txt -git log ${REVISION} -1 -- ../../data >> upgrade_ruleset_version.txt +echo "$DESCRIPTION" >> upgrade_ruleset_version.txt -- 2.30.2