From e3bc11a4fa1244a94a12f5555d5a7accd7dc1948 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 26 Nov 2025 13:09:57 +0100 Subject: [PATCH] Embed version in git-archive tarballs and populate VERSION from it when set Closes: #90 --- .gitattributes | 1 + .tarball-version-git | 1 + Makefile | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .tarball-version-git diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f43959a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.tarball-version-git export-subst diff --git a/.tarball-version-git b/.tarball-version-git new file mode 100644 index 0000000..f4034a5 --- /dev/null +++ b/.tarball-version-git @@ -0,0 +1 @@ +$Format:%(describe)$ diff --git a/Makefile b/Makefile index 3d27dcc..8eb03bb 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SHRDIR := $(PREFIX)/share MANDIR := $(PREFIX)/share/man BINS = $(filter-out %_test.go,$(notdir $(wildcard cmd/*))) TAG = $(shell git describe --abbrev=0 --tags) -VERSION = $(shell git describe --abbrev=7 | sed 's/-/./g;s/^v//;') +VERSION = $(shell if grep Format .tarball-version-git > /dev/null; then git describe --abbrev=7 | sed 's/-/./g;s/^v//;'; else cat .tarball-version-git; fi) MANPAGES = \ man/ssh-tpm-hostkeys.1 \