MCPcopy Create free account
hub / github.com/github/gh-aw / IsHexString

Function IsHexString

pkg/gitutil/gitutil.go:51–61  ·  view source on GitHub ↗

IsHexString checks if a string contains only hexadecimal characters. This is used to validate Git commit SHAs and other hexadecimal identifiers.

(s string)

Source from the content-addressed store, hash-verified

49// IsHexString checks if a string contains only hexadecimal characters.
50// This is used to validate Git commit SHAs and other hexadecimal identifiers.
51func IsHexString(s string) bool {
52 if s == "" {
53 return false
54 }
55 for _, c := range s {
56 if (c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F') {
57 return false
58 }
59 }
60 return true
61}
62
63// IsValidFullSHA checks if s is a valid 40-character lowercase hexadecimal SHA.
64func IsValidFullSHA(s string) bool {

Callers 8

resolveRefToSHAViaGitFunction · 0.92
resolveRefToSHAFunction · 0.92
downloadFileViaGitCloneFunction · 0.92
ParseTagRefTSVFunction · 0.92
TestIsHexStringFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestIsHexStringFunction · 0.68