From: Anthony Fok Date: Tue, 28 Jun 2022 13:59:03 +0000 (-0600) Subject: Accept vendor-specified build date if .git/ is unavailable X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8ebcaa539;p=brevno-suite%2Fhugo Accept vendor-specified build date if .git/ is unavailable Fixes #10053 --- 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 @@ -153,6 +153,10 @@ func BuildVersionString() string { osArch := bi.GoOS + "/" + bi.GoArch date := bi.RevisionTime + if date == "" { + // Accept vendor-specified build date if .git/ is unavailable. + date = buildDate + } if date == "" { date = "unknown" }