MCPcopy
hub / github.com/git-lfs/git-lfs / RootDir

Function RootDir

git/git.go:836–857  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

834}
835
836func RootDir() (string, error) {
837 cmd, err := gitNoLFS("rev-parse", "--show-toplevel")
838 if err != nil {
839 return "", errors.New(tr.Tr.Get("failed to find `git rev-parse --show-toplevel`: %v", err))
840 }
841 out, err := cmd.Output()
842 if err != nil {
843 return "", errors.New(tr.Tr.Get("failed to call `git rev-parse --show-toplevel`: %v %v", err, string(out)))
844 }
845
846 path := strings.TrimSpace(string(out))
847 path, err = tools.TranslateCygwinPath(path)
848 if err != nil {
849 return "", err
850 }
851
852 if len(path) == 0 {
853 return "", errors.New(tr.Tr.Get("no output from `git rev-parse --show-toplevel`"))
854 }
855
856 return tools.CanonicalizePath(path, false)
857}
858
859func GitDir() (string, error) {
860 cmd, err := gitNoLFS("rev-parse", "--git-dir")

Callers 1

Calls 6

NewFunction · 0.92
TranslateCygwinPathFunction · 0.92
CanonicalizePathFunction · 0.92
gitNoLFSFunction · 0.85
GetMethod · 0.65
OutputMethod · 0.45

Tested by

no test coverage detected