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

Method TrackingBranchNames

git/client.go:712–726  ·  view source on GitHub ↗
(ctx context.Context, prefix string)

Source from the content-addressed store, hash-verified

710}
711
712func (c *Client) TrackingBranchNames(ctx context.Context, prefix string) []string {
713 args := []string{"branch", "-r", "--format", "%(refname:strip=3)"}
714 if prefix != "" {
715 args = append(args, "--list", fmt.Sprintf("*/%s*", escapeGlob(prefix)))
716 }
717 cmd, err := c.Command(ctx, args...)
718 if err != nil {
719 return nil
720 }
721 output, err := cmd.Output()
722 if err != nil {
723 return nil
724 }
725 return strings.Split(string(output), "\n")
726}
727
728// ToplevelDir returns the top-level directory path of the current repository.
729func (c *Client) ToplevelDir(ctx context.Context) (string, error) {

Callers

nothing calls this directly

Calls 3

CommandMethod · 0.95
escapeGlobFunction · 0.85
OutputMethod · 0.65

Tested by

no test coverage detected