aboutsummaryrefslogtreecommitdiff
path: root/GIT-VERSION-GEN
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-12-06 14:24:41 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-07 07:52:09 +0900
commita38edab7c88b5503bb2b5f5cbd49f6b97e9a6a4e (patch)
treee52df1ab95432e22e4ae5be757c4131a88062069 /GIT-VERSION-GEN
parent9bb10d27e7072cec919d38f0b987c70e598039ad (diff)
downloadgit-a38edab7c88b5503bb2b5f5cbd49f6b97e9a6a4e.tar.xz
Makefile: generate doc versions via GIT-VERSION-GEN
The documentation we generate embeds information for the exact Git version used as well as the date of the commit. This information is injected by injecting attributes into the build process via command line argument. Refactor the logic so that we write the information into "asciidoc.conf" and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and AsciiDoctor, respectively. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'GIT-VERSION-GEN')
-rwxr-xr-xGIT-VERSION-GEN2
1 files changed, 2 insertions, 0 deletions
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index a1c8146f05..b4687784c1 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -53,6 +53,7 @@ fi
GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
if test -z "$GIT_USER_AGENT"
then
GIT_USER_AGENT="git/$GIT_VERSION"
@@ -72,6 +73,7 @@ sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
-e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
-e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
-e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
"$INPUT" >"$OUTPUT"+
if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null