summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-19 15:05:36 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-19 15:05:36 +1000
commit93266cc2a4845de7c164d33df2197af599c2ddcd (patch)
tree95b80d5c67835656fc3ca4a6740592cb905a19c3
parent6978785ccfdf6605501e1b36d2a4bc9635a89b99 (diff)
support forked branches when getting project root
-rw-r--r--pkg/utils/utils.go8
1 files changed, 5 insertions, 3 deletions
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"
}