From 60db6a7b424433246d80609ce323645fc80a9ea8 Mon Sep 17 00:00:00 2001 From: Martin HS Date: Mon, 19 Aug 2024 13:35:04 +0200 Subject: [PATCH] internal/build: include git-date on detached head (#30320) When we are building in detached head, we cannot easily obtain the same information as we can if we're in non-detached head. However, one thing we _can_ obtain is the git-hash and git-date. Currently, we omit to include the git-date into the build-info, which causes problem for reproducable builds which are on a detached head. This change fixes it to include the date-info always. --- internal/build/env.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/build/env.go b/internal/build/env.go index 0854fba249..35b2cd6ae7 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -111,6 +111,7 @@ func LocalEnv() Environment { commitRe, _ := regexp.Compile("^([0-9a-f]{40})$") if commit := commitRe.FindString(head); commit != "" && env.Commit == "" { env.Commit = commit + env.Date = getDate(env.Commit) } return env }