MCPcopy Index your code
hub / github.com/cli/cli / ShortRef

Function ShortRef

internal/skills/discovery/discovery.go:137–145  ·  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

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