mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-06 04:01:05 +09:00
refactor: simplify ParseCatFileTreeLine and catBatchParseTreeEntries (#37210)
Simplify ParseCatFileTreeLine: it is faster without the preset buffers, and easier to read and maintain. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -66,9 +66,10 @@ func ParseEntryMode(mode string) EntryMode {
|
||||
return EntryModeSymlink
|
||||
case "160000":
|
||||
return EntryModeCommit
|
||||
case "040000":
|
||||
case "040000", "40000": // leading-zero is optional
|
||||
return EntryModeTree
|
||||
default:
|
||||
// if the faster path didn't work, try parsing the mode as an integer and masking off the file type bits
|
||||
// git uses 040000 for tree object, but some users may get 040755 from non-standard git implementations
|
||||
m, _ := strconv.ParseInt(mode, 8, 32)
|
||||
modeInt := EntryMode(m)
|
||||
|
||||
Reference in New Issue
Block a user