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

Function ShortRef

internal/skills/discovery/discovery.go:138–146  ·  view source on GitHub ↗

ShortRef strips the "refs/heads/" or "refs/tags/" prefix from a fully qualified ref, returning the short name. If the ref is not fully qualified it is returned as-is.

(ref string)

Source from the content-addressed store, hash-verified

136// ShortRef strips the "refs/heads/" or "refs/tags/" prefix from a fully qualified ref,
137// returning the short name. If the ref is not fully qualified it is returned as-is.
138func ShortRef(ref string) string {
139 if after, ok := strings.CutPrefix(ref, "refs/heads/"); ok {
140 return after
141 }
142 if after, ok := strings.CutPrefix(ref, "refs/tags/"); ok {
143 return after
144 }
145 return ref
146}
147
148type treeEntry struct {
149 Path string `json:"path"`

Callers 5

updateRunFunction · 0.92
parseInstalledSkillFunction · 0.92
installRunFunction · 0.92
resolveVersionFunction · 0.92
TestShortRefFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestShortRefFunction · 0.68