diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-19 14:48:39 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-19 14:48:39 +1000 |
commit | cd9eada0c6b3fdb68519467807bf2c8e6eb521bd (patch) | |
tree | f41c0db2dcc800059e8cb31d45f26b9e14a20318 /pkg/utils/utils.go | |
parent | bd91b9e1e9fdc8cd199d105118ce13f94e6b5fe5 (diff) |
add test for variety of potential git diff situations
Diffstat (limited to 'pkg/utils/utils.go')
-rw-r--r-- | pkg/utils/utils.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 68438246a..6172bcb54 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "path" "path/filepath" "strings" @@ -63,3 +64,11 @@ func TrimTrailingNewline(str string) string { } return str } + +// GetProjectRoot returns the path to the root of the project. Only to be used +// 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") +} |