Files
buildkit/util/gitutil/git_commit.go
Justin Chadwell 90d2d8b1c6 git: allow cloning commit shas not referenced by branch/tag
Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-10-22 11:38:04 +01:00

20 lines
245 B
Go

package gitutil
func IsCommitSHA(str string) bool {
if len(str) != 40 {
return false
}
for _, ch := range str {
if ch >= '0' && ch <= '9' {
continue
}
if ch >= 'a' && ch <= 'f' {
continue
}
return false
}
return true
}