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

Method TrackingBranchNames

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

Source from the content-addressed store, hash-verified

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