Refactor RefName (#33234)

And fix some FIXMEs
This commit is contained in:
wxiaoguang 2025-01-13 14:01:53 +08:00 committed by GitHub
parent 81352542fd
commit 2ea929a952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 58 additions and 60 deletions

View file

@ -476,8 +476,12 @@ func (c *Commit) GetRepositoryDefaultPublicGPGKey(forceUpdate bool) (*GPGSetting
}
func IsStringLikelyCommitID(objFmt ObjectFormat, s string, minLength ...int) bool {
minLen := util.OptionalArg(minLength, objFmt.FullLength())
if len(s) < minLen || len(s) > objFmt.FullLength() {
maxLen := 64 // sha256
if objFmt != nil {
maxLen = objFmt.FullLength()
}
minLen := util.OptionalArg(minLength, maxLen)
if len(s) < minLen || len(s) > maxLen {
return false
}
for _, c := range s {