Skip to content

Commit

Permalink
internal/build: include git-date on detached head (#30320)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
holiman authored Aug 19, 2024
1 parent 710c3f3 commit 60db6a7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/build/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 60db6a7

Please sign in to comment.