ListMatchingRefs lists references in a repository that match a supplied ref. The ref in the URL must be formatted as `heads/ ` for branches and `tags/ ` for tags. If the ref doesn't exist in the repository, but existing refs start with ref, they will be returned as an array. Use
(ctx context.Context, owner, repo, ref string)
| 91 | // |
| 92 | //meta:operation GET /repos/{owner}/{repo}/git/matching-refs/{ref} |
| 93 | func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo, ref string) ([]*Reference, *Response, error) { |
| 94 | ref = strings.TrimPrefix(ref, "refs/") // API expects no "refs/" prefix |
| 95 | u := fmt.Sprintf("repos/%v/%v/git/matching-refs/%v", owner, repo, refURLEscape(ref)) |
| 96 | |
| 97 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 98 | if err != nil { |
| 99 | return nil, nil, err |
| 100 | } |
| 101 | |
| 102 | var rs []*Reference |
| 103 | resp, err := s.client.Do(req, &rs) |
| 104 | if err != nil { |
| 105 | return nil, resp, err |
| 106 | } |
| 107 | |
| 108 | return rs, resp, nil |
| 109 | } |
| 110 | |
| 111 | // CreateRef creates a new ref in a repository. |
| 112 | // |