MCPcopy Create free account
hub / github.com/antonmedv/gitmal / RefToFileName

Function RefToFileName

pkg/git/utils.go:79–91  ·  view source on GitHub ↗
(ref string)

Source from the content-addressed store, hash-verified

77}
78
79func RefToFileName(ref string) string {
80 var result strings.Builder
81 for _, c := range ref {
82 if (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '.' {
83 result.WriteByte(byte(c))
84 } else if c >= 'A' && c <= 'Z' {
85 result.WriteByte(byte(c - 'A' + 'a'))
86 } else {
87 result.WriteByte('-')
88 }
89 }
90 return result.String()
91}

Callers 2

TestRefToFileNameFunction · 0.92
NewRefFunction · 0.85

Calls 2

WriteByteMethod · 0.80
StringMethod · 0.45

Tested by 1

TestRefToFileNameFunction · 0.74