MCPcopy
hub / github.com/cli/cli / ToplevelDir

Method ToplevelDir

git/client.go:667–673  ·  view source on GitHub ↗

ToplevelDir returns the top-level directory path of the current repository.

(ctx context.Context)

Source from the content-addressed store, hash-verified

665
666// ToplevelDir returns the top-level directory path of the current repository.
667func (c *Client) ToplevelDir(ctx context.Context) (string, error) {
668 out, err := c.revParse(ctx, "--show-toplevel")
669 if err != nil {
670 return "", err
671 }
672 return firstLine(out), nil
673}
674
675func (c *Client) GitDir(ctx context.Context) (string, error) {
676 out, err := c.revParse(ctx, "--git-dir")

Callers 3

TestClientToplevelDirFunction · 0.95
fetchMethod · 0.95
ResolveGitRootFunction · 0.80

Calls 2

revParseMethod · 0.95
firstLineFunction · 0.85

Tested by 1

TestClientToplevelDirFunction · 0.76