From a2fa1d07d1df887dcb988b4e5064bf61faff786e Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 22 Jul 2018 11:11:08 +0100 Subject: [PATCH] docs/man: Make generate script use git timestamps When regenerating the manpages, the mtime of the pod files is used. That mtime can change based on file and repository manipulations, because git does not preserve mtimes. This causes unnecessary regenerations which require manual cleanups in order to avoid cluttering the history unnecessarily. This patch makes the generate script set the mtime of the pod files to the time of the last git commit that affected them, if they have not changed since. This avoids unnecessary changes and makes the script easier to use. There's one file that needed adjustment to match its last commit time, that is also included here. --- docs/man/generate.sh | 8 ++++++++ docs/man/smtp-check.1 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/man/generate.sh b/docs/man/generate.sh index f14ebf6..2f29a58 100755 --- a/docs/man/generate.sh +++ b/docs/man/generate.sh @@ -12,6 +12,14 @@ for IN in *.pod; do SECTION=${OUT##*.} NAME=${OUT%.*} + # If it has not changed in git, set the mtime to the last commit that + # touched the file. + CHANGED=$( git status --porcelain -- "$IN" | wc -l ) + if [ $CHANGED -eq 0 ]; then + GIT_MTIME=$( git log --pretty=%at -n1 -- "$IN" ) + touch -d "@$GIT_MTIME" "$IN" + fi + podchecker $IN pod2man --section=$SECTION --name=$NAME \ --release "" --center "" \ diff --git a/docs/man/smtp-check.1 b/docs/man/smtp-check.1 index a5e6cef..c4b080a 100644 --- a/docs/man/smtp-check.1 +++ b/docs/man/smtp-check.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "smtp-check 1" -.TH smtp-check 1 "2018-04-03" "" "" +.TH smtp-check 1 "2018-04-02" "" "" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l