code.gitea.io/gitea@v1.22.3/modules/git/tree_test.go (about) 1 // Copyright 2024 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package git 5 6 import ( 7 "path/filepath" 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestSubTree_Issue29101(t *testing.T) { 14 repo, err := openRepositoryWithDefaultContext(filepath.Join(testReposDir, "repo1_bare")) 15 assert.NoError(t, err) 16 defer repo.Close() 17 18 commit, err := repo.GetCommit("ce064814f4a0d337b333e646ece456cd39fab612") 19 assert.NoError(t, err) 20 21 // old code could produce a different error if called multiple times 22 for i := 0; i < 10; i++ { 23 _, err = commit.SubTree("file1.txt") 24 assert.Error(t, err) 25 assert.True(t, IsErrNotExist(err)) 26 } 27 }