Skip to content

Commit

Permalink
dockerignore, internal/build: forward correct git folder
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Nov 12, 2017
1 parent cb8bbe7 commit e401536
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**/.git
/.git
!/.git/HEAD
!/.git/refs/heads
.git
!.git/HEAD
!.git/refs/heads
**/*_test.go

build/_workspace
Expand Down
5 changes: 3 additions & 2 deletions internal/build/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions internal/build/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit e401536

Please sign in to comment.