1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-04 00:28:36 +00:00

Fix submodule nil check (#35096) (#35098)

Backport #35096 by wxiaoguang

Fix  #35095

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2025-07-16 21:02:18 +08:00
committed by GitHub
parent f7ef657b5a
commit f99bbd7f3f
3 changed files with 14 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import (
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
@@ -120,6 +121,16 @@ func TestEntries_GetCommitsInfo(t *testing.T) {
defer clonedRepo1.Close()
testGetCommitsInfo(t, clonedRepo1)
t.Run("NonExistingSubmoduleAsNil", func(t *testing.T) {
commit, err := bareRepo1.GetCommit("HEAD")
require.NoError(t, err)
tree, err := commit.GetTreeEntryByPath("file1.txt")
require.NoError(t, err)
cisf, err := getCommitInfoSubmoduleFile("/any/repo-link", tree, commit, "")
require.NoError(t, err)
assert.Nil(t, cisf)
})
}
func BenchmarkEntries_GetCommitsInfo(b *testing.B) {