MCPcopy
hub / github.com/go-git/go-git / IsHash

Function IsHash

plumbing/hash.go:76–84  ·  view source on GitHub ↗

IsHash returns true if the given string is a valid hash.

(s string)

Source from the content-addressed store, hash-verified

74
75// IsHash returns true if the given string is a valid hash.
76func IsHash(s string) bool {
77 switch len(s) {
78 case hash.HexSize:
79 _, err := hex.DecodeString(s)
80 return err == nil
81 default:
82 return false
83 }
84}

Callers 4

parseObjectIDHexFunction · 0.92
OpenChainFileFunction · 0.92
IsExactSHA1Method · 0.92
TestIsHashMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestIsHashMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…