MCPcopy Create free account
hub / github.com/cli/cli / ToplevelDir

Method ToplevelDir

git/client.go:729–735  ·  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

727
728// ToplevelDir returns the top-level directory path of the current repository.
729func (c *Client) ToplevelDir(ctx context.Context) (string, error) {
730 out, err := c.revParse(ctx, "--show-toplevel")
731 if err != nil {
732 return "", err
733 }
734 return firstLine(out), nil
735}
736
737func (c *Client) GitDir(ctx context.Context) (string, error) {
738 out, err := c.revParse(ctx, "--git-dir")

Callers 4

TestClientToplevelDirFunction · 0.95
fetchMethod · 0.95
deleteLocalBranchMethod · 0.80
ResolveGitRootFunction · 0.80

Calls 2

revParseMethod · 0.95
firstLineFunction · 0.85

Tested by 1

TestClientToplevelDirFunction · 0.76