diff options
author | Anthony Fok <foka@debian.org> | 2022-06-28 07:59:03 -0600 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-06-28 20:51:18 +0200 |
commit | 8ebcaa5394dd398c0929addfcd8b9c776820f8f0 (patch) | |
tree | a89a44bf540360bd467a9922b8f80eb3192785f3 /common | |
parent | 241481931f5f5f2803cd4be519936b26d8648dfd (diff) |
Accept vendor-specified build date if .git/ is unavailable
Fixes #10053
Diffstat (limited to 'common')
-rw-r--r-- | common/hugo/hugo.go | 2 | ||||
-rw-r--r-- | common/hugo/version.go | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index d78564a67..54fbd65a3 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -38,6 +38,8 @@ const ( ) var ( + // buildDate allows vendor-specified build date when .git/ is unavailable. + buildDate string // vendorInfo contains vendor notes about the current build. vendorInfo string ) diff --git a/common/hugo/version.go b/common/hugo/version.go index edcb983d7..3bb6472e2 100644 --- a/common/hugo/version.go +++ b/common/hugo/version.go @@ -154,6 +154,10 @@ func BuildVersionString() string { date := bi.RevisionTime if date == "" { + // Accept vendor-specified build date if .git/ is unavailable. + date = buildDate + } + if date == "" { date = "unknown" } |