1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

add test for variety of potential git diff situations

This commit is contained in:
Jesse Duffield
2018-08-19 14:48:39 +10:00
parent bd91b9e1e9
commit cd9eada0c6
4 changed files with 181 additions and 21 deletions

View File

@ -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")
}