mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 05:09:57 +00:00
refactor: remove Ctx field from git.Repository (#38500)
This commit is contained in:
@@ -118,7 +118,8 @@ func expectedAttrs() *Attributes {
|
||||
func Test_BatchChecker(t *testing.T) {
|
||||
setting.AppDataPath = t.TempDir()
|
||||
repoPath := "../tests/repos/language_stats_repo"
|
||||
gitRepo, err := git.OpenRepository(t.Context(), repoPath)
|
||||
ctx := t.Context()
|
||||
gitRepo, err := git.OpenRepository(repoPath)
|
||||
require.NoError(t, err)
|
||||
defer gitRepo.Close()
|
||||
|
||||
@@ -126,7 +127,7 @@ func Test_BatchChecker(t *testing.T) {
|
||||
|
||||
t.Run("Create index file to run git check-attr", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&git.DefaultFeatures().SupportCheckAttrOnBare, false)()
|
||||
checker, err := NewBatchChecker(gitRepo, commitID, LinguistAttributes)
|
||||
checker, err := NewBatchChecker(ctx, gitRepo, commitID, LinguistAttributes)
|
||||
assert.NoError(t, err)
|
||||
defer checker.Close()
|
||||
attributes, err := checker.CheckPath("i-am-a-python.p")
|
||||
@@ -143,11 +144,11 @@ func Test_BatchChecker(t *testing.T) {
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
tempRepo, err := git.OpenRepository(t.Context(), dir)
|
||||
tempRepo, err := git.OpenRepository(dir)
|
||||
assert.NoError(t, err)
|
||||
defer tempRepo.Close()
|
||||
|
||||
checker, err := NewBatchChecker(tempRepo, "", LinguistAttributes)
|
||||
checker, err := NewBatchChecker(t.Context(), tempRepo, "", LinguistAttributes)
|
||||
assert.NoError(t, err)
|
||||
defer checker.Close()
|
||||
attributes, err := checker.CheckPath("i-am-a-python.p")
|
||||
@@ -161,7 +162,7 @@ func Test_BatchChecker(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("Run git check-attr in bare repository", func(t *testing.T) {
|
||||
checker, err := NewBatchChecker(gitRepo, commitID, LinguistAttributes)
|
||||
checker, err := NewBatchChecker(ctx, gitRepo, commitID, LinguistAttributes)
|
||||
assert.NoError(t, err)
|
||||
defer checker.Close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user