Skip to content

Commit 7cc1180

Browse files
committed
add test
1 parent ca0a1fe commit 7cc1180

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/git/commit_info_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
1213
)
1314

1415
const (
@@ -120,6 +121,16 @@ func TestEntries_GetCommitsInfo(t *testing.T) {
120121
defer clonedRepo1.Close()
121122

122123
testGetCommitsInfo(t, clonedRepo1)
124+
125+
t.Run("NonExistingSubmoduleAsNil", func(t *testing.T) {
126+
commit, err := bareRepo1.GetCommit("HEAD")
127+
require.NoError(t, err)
128+
tree, err := commit.GetTreeEntryByPath("file1.txt")
129+
require.NoError(t, err)
130+
cisf, err := getCommitInfoSubmoduleFile("/any/repo-link", tree, commit, "")
131+
require.NoError(t, err)
132+
assert.Nil(t, cisf)
133+
})
123134
}
124135

125136
func BenchmarkEntries_GetCommitsInfo(b *testing.B) {

0 commit comments

Comments
 (0)