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

Function ShortRef

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

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