DigestAlgForRef returns the digest algorithm name corresponding to the given git ref SHA. SHA-1 git object IDs are 40 hex characters and SHA-256 git object IDs are 64 hex characters. Unknown lengths default to "sha1" to preserve backwards-compatible behavior.
(digest string)
| 180 | // object IDs are 64 hex characters. Unknown lengths default to "sha1" to |
| 181 | // preserve backwards-compatible behavior. |
| 182 | func DigestAlgForRef(digest string) string { |
| 183 | switch len(digest) { |
| 184 | case 64: |
| 185 | return "sha256" |
| 186 | default: |
| 187 | return "sha1" |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | // FetchRelease finds a published repository release by its tagName, or a draft release by its pending tag name. |
| 192 | func FetchRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface, tagName string) (*Release, error) { |
no outgoing calls