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

Method TrackingBranchNames

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

Source from the content-addressed store, hash-verified

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