(refPattern string)
| 1003 | } |
| 1004 | |
| 1005 | func (repo *GitRepo) getRefHashes(refPattern string) (map[string]string, error) { |
| 1006 | if !strings.HasSuffix(refPattern, "/*") { |
| 1007 | return nil, fmt.Errorf("unsupported ref pattern %q", refPattern) |
| 1008 | } |
| 1009 | refPrefix := strings.TrimSuffix(refPattern, "*") |
| 1010 | showRef, err := repo.runGitCommand("show-ref") |
| 1011 | if err != nil { |
| 1012 | return nil, err |
| 1013 | } |
| 1014 | refsMap := make(map[string]string) |
| 1015 | for _, line := range strings.Split(showRef, "\n") { |
| 1016 | lineParts := strings.Split(line, " ") |
| 1017 | if len(lineParts) != 2 { |
| 1018 | return nil, fmt.Errorf("unexpected line in output of `git show-ref`: %q", line) |
| 1019 | } |
| 1020 | if strings.HasPrefix(lineParts[1], refPrefix) { |
| 1021 | refsMap[lineParts[1]] = lineParts[0] |
| 1022 | } |
| 1023 | } |
| 1024 | return refsMap, nil |
| 1025 | } |
| 1026 | |
| 1027 | func getRemoteNotesRef(remote, localNotesRef string) string { |
| 1028 | // Note: The pattern for remote notes deviates from that of remote heads and devtools, |
no test coverage detected