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

Method ToplevelDir

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

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

Calls 2

revParseMethod · 0.95
firstLineFunction · 0.70