From 93266cc2a4845de7c164d33df2197af599c2ddcd Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 19 Aug 2018 15:05:36 +1000 Subject: support forked branches when getting project root --- pkg/utils/utils.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pkg/utils') diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 6172bcb54..0333ac45a 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -4,7 +4,6 @@ import ( "fmt" "log" "os" - "path" "path/filepath" "strings" @@ -69,6 +68,9 @@ func TrimTrailingNewline(str string) string { // in testing contexts, as with binaries it's unlikely this path will exist on // the machine func GetProjectRoot() string { - gp := os.Getenv("GOPATH") - return path.Join(gp, "src/github.com/jesseduffield/lazygit") + dir, err := os.Getwd() + if err != nil { + panic(err) + } + return strings.Split(dir, "lazygit")[0] + "lazygit" } -- cgit v1.2.3