mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-10 13:31:01 -05:00
Refactor ls-tree and git path related problems (#35858)
Fix #35852, the root problem is that the "name" field is heavily abused (since #6816, and no way to get a clear fix) There are still a lot of legacy problems in old code. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
27
modules/git/tree_entry_gogit_test.go
Normal file
27
modules/git/tree_entry_gogit_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
//go:build gogit
|
||||
|
||||
package git
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-git/go-git/v5/plumbing/filemode"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEntryGogit(t *testing.T) {
|
||||
cases := map[EntryMode]filemode.FileMode{
|
||||
EntryModeBlob: filemode.Regular,
|
||||
EntryModeCommit: filemode.Submodule,
|
||||
EntryModeExec: filemode.Executable,
|
||||
EntryModeSymlink: filemode.Symlink,
|
||||
EntryModeTree: filemode.Dir,
|
||||
}
|
||||
for emode, fmode := range cases {
|
||||
assert.EqualValues(t, fmode, entryModeToGogitFileMode(emode))
|
||||
assert.EqualValues(t, emode, gogitFileModeToEntryMode(fmode))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user