MCPcopy Index your code
hub / github.com/git-bug/git-bug / IsValid

Method IsValid

repository/hash.go:40–51  ·  view source on GitHub ↗

IsValid tell if the hash is valid

()

Source from the content-addressed store, hash-verified

38
39// IsValid tell if the hash is valid
40func (h *Hash) IsValid() bool {
41 // Support for both sha1 and sha256 git hashes
42 if len(*h) != idLengthSHA1 && len(*h) != idLengthSHA256 {
43 return false
44 }
45 for _, r := range *h {
46 if (r < 'a' || r > 'f') && (r < '0' || r > '9') {
47 return false
48 }
49 }
50 return true
51}

Callers 4

UnmarshalGQLMethod · 0.95
RepoDataTestFunction · 0.80
ServeHTTPMethod · 0.80
ValidateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected