chore: fix git commit "rev-list" (#38069)

Fix the copied & pasted messy code, fix #38067

Now, "limit=-1" means "no limit"
This commit is contained in:
wxiaoguang
2026-06-12 02:08:55 +08:00
committed by GitHub
parent 5a24438698
commit d3d092f65d
20 changed files with 145 additions and 203 deletions

View File

@@ -7,6 +7,7 @@ import (
"regexp"
"strings"
"gitea.dev/modules/setting"
"gitea.dev/modules/util"
)
@@ -72,6 +73,8 @@ const ForPrefix = "refs/for/"
// RefName represents a full git reference name
type RefName string
const RefNameHead = "HEAD"
func RefNameFromBranch(shortName string) RefName {
return RefName(BranchPrefix + shortName)
}
@@ -81,6 +84,10 @@ func RefNameFromTag(shortName string) RefName {
}
func RefNameFromCommit(shortName string) RefName {
if !isStringLowerHex(shortName) {
setting.PanicInDevOrTesting("BUG! invalid commit id %s", shortName)
return RefName("refs/invalid-commit/" + shortName)
}
return RefName(shortName)
}