Skip to content

Commit 60db6a7

Browse files
authored
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 710c3f3 commit 60db6a7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

internal/build/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func LocalEnv() Environment {
111111
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
112112
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
113113
env.Commit = commit
114+
env.Date = getDate(env.Commit)
114115
}
115116
return env
116117
}

0 commit comments

Comments
 (0)