Drop the date from the committed man page (#3659)

The date in the .TH line of jq.1.prebuilt changed whenever the manual was
regenerated in a new month, causing merge conflicts between pull requests
that touch the manual, and it did not reflect the release date anyway.
Generate the committed man page without a date.

Stamp the date into jq.1 at build time instead, taking it from the current
commit, or from SOURCE_DATE_EPOCH where that is set, so that release
tarballs and distribution builds still carry one and the behaviour added
in #3514 is kept. Write it in UTC and in ISO 8601 rather than the previous
"%B %Y", for which mandoc reports "cannot parse date, using it verbatim".
This commit is contained in:
itchyny authored and GitHub committed 2026-10-08 22:16:42 +09:00
1 parent fd25c3e720
commit 17b87d25c7
4 files changed
+15 -14

No files matched your search

+11 -1
View File
@@ -190,8 +190,18 @@ else
@echo As a result, the manpage is out of date.
endif
# The committed manpage has no date to avoid merge conflicts. Stamp the date
# of the last commit when building in a git repository, including on make
# dist, so that release tarballs ship a dated jq.1. Respect SOURCE_DATE_EPOCH
# so that distribution builds can pin the date.
jq.1: jq.1.prebuilt
$(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@
$(AM_V_GEN) date=`if test -n "$$SOURCE_DATE_EPOCH"; then \
date -u -d "@$$SOURCE_DATE_EPOCH" +%F 2>/dev/null || \
date -u -r "$$SOURCE_DATE_EPOCH" +%F 2>/dev/null; \
elif test -e $(srcdir)/.git; then \
cd $(srcdir) && git log -1 --format=%cd --date=short 2>/dev/null; \
fi`; \
sed 's/^\.TH "JQ" "1" ""/.TH "JQ" "1" "'"$$date"'"/' $(srcdir)/jq.1.prebuilt > $@
CLEANFILES += jq.1