forked from gitea/gitea
1
0
Fork 0

Treat git object mode 40755 as directory (#21195) (#21218)

Backport #21195

Git uses 040000 for tree object, but some users may get 040755 for
unknown reasons, fix #21190

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
wxiaoguang 2022-09-21 00:40:23 +08:00 committed by GitHub
parent 54d4e664c2
commit 937ef6fa90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ func parseTreeEntries(data []byte, ptree *Tree) ([]*TreeEntry, error) {
case "160000": case "160000":
entry.entryMode = EntryModeCommit entry.entryMode = EntryModeCommit
pos += 14 // skip over "160000 object " pos += 14 // skip over "160000 object "
case "040000": case "040000", "040755": // git uses 040000 for tree object, but some users may get 040755 for unknown reasons
entry.entryMode = EntryModeTree entry.entryMode = EntryModeTree
pos += 12 // skip over "040000 tree " pos += 12 // skip over "040000 tree "
default: default:
@ -119,7 +119,7 @@ loop:
entry.entryMode = EntryModeSymlink entry.entryMode = EntryModeSymlink
case "160000": case "160000":
entry.entryMode = EntryModeCommit entry.entryMode = EntryModeCommit
case "40000": case "40000", "40755": // git uses 40000 for tree object, but some users may get 40755 for unknown reasons
entry.entryMode = EntryModeTree entry.entryMode = EntryModeTree
default: default:
log.Debug("Unknown mode: %v", string(mode)) log.Debug("Unknown mode: %v", string(mode))