diff --git a/.dockerignore b/.dockerignore index 751ff2a0c25b757a204b30be80cd62d80828b02a..d280741c6062c5e95b87b1ee11bd219b14b16c6a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ **/.git -/.git -!/.git/HEAD -!/.git/refs/heads +.git +!.git/HEAD +!.git/refs/heads **/*_test.go build/_workspace diff --git a/internal/build/env.go b/internal/build/env.go index 793242fcf028436c14e0d1c486e2d93d1118f190..c9848bf82cf8e5616464ad0b2d28ba22f2296247 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -82,14 +82,15 @@ func Env() Environment { // LocalEnv returns build environment metadata gathered from git. func LocalEnv() Environment { env := applyEnvFlags(Environment{Name: "local", Repo: "ethereum/go-ethereum"}) - head := ReadGitFile("HEAD") + + head := readGitFile("HEAD") if splits := strings.Split(head, " "); len(splits) == 2 { head = splits[1] } else { return env } if env.Commit == "" { - env.Commit = ReadGitFile(head) + env.Commit = readGitFile(head) } if env.Branch == "" { if head != "HEAD" { diff --git a/internal/build/util.go b/internal/build/util.go index 91465c41991c8792123a08d2c8d4db42c38cb895..c6e059f0dfdee383db2b8099034f14ce847334a8 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -89,8 +89,8 @@ func RunGit(args ...string) string { return strings.TrimSpace(stdout.String()) } -// ReadGitFile returns content of file in .git directory. -func ReadGitFile(file string) string { +// readGitFile returns content of file in .git directory. +func readGitFile(file string) string { content, err := ioutil.ReadFile(path.Join(".git", file)) if err != nil { return ""