]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Accept vendor-specified build date if .git/ is unavailable
authorAnthony Fok <foka@debian.org>
Tue, 28 Jun 2022 13:59:03 +0000 (07:59 -0600)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 28 Jun 2022 18:51:18 +0000 (20:51 +0200)
Fixes #10053

common/hugo/hugo.go
common/hugo/version.go

index d78564a67db35e37f28bcb3749d4172c929049d7..54fbd65a3650fb97ab190307b18272085d7ab1dc 100644 (file)
@@ -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
 )
index edcb983d730f0ec1c246603dbc2a49b3f20eb906..3bb6472e2fad481f4b0a86f8c4bdda745e96608b 100644 (file)
@@ -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"
        }