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

Method ToplevelDir

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

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