mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
dockerignore, internal/build: forward correct git folder
This commit is contained in:
parent
cb8bbe7081
commit
e401536c97
@ -1,7 +1,7 @@
|
||||
**/.git
|
||||
/.git
|
||||
!/.git/HEAD
|
||||
!/.git/refs/heads
|
||||
.git
|
||||
!.git/HEAD
|
||||
!.git/refs/heads
|
||||
**/*_test.go
|
||||
|
||||
build/_workspace
|
||||
|
@ -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" {
|
||||
|
@ -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 ""
|
||||
|
Loading…
Reference in New Issue
Block a user