Skip to content

Commit 6b509b1

Browse files
holimanucwong
authored andcommitted
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.
1 parent 69d2195 commit 6b509b1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

internal/build/env.go

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func LocalEnv() Environment {
109109
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
110110
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
111111
env.Commit = commit
112+
env.Date = getDate(env.Commit)
112113
}
113114
return env
114115
}

0 commit comments

Comments
 (0)