Skip to content

Commit de436db

Browse files
committed
Add a wrap for new batch
1 parent 7885c77 commit de436db

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

modules/gitrepo/cat_file.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package gitrepo
5+
6+
import (
7+
"context"
8+
9+
"code.gitea.io/gitea/modules/git"
10+
)
11+
12+
func NewBatch(ctx context.Context, repo Repository) (*git.Batch, error) {
13+
return git.NewBatch(ctx, repoPath(repo))
14+
}

modules/indexer/code/bleve/bleve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (b *Indexer) addDelete(filename string, repo *repo_model.Repository, batch
218218
func (b *Indexer) Index(ctx context.Context, repo *repo_model.Repository, sha string, changes *internal.RepoChanges) error {
219219
batch := inner_bleve.NewFlushingBatch(b.inner.Indexer, maxBatchSize)
220220
if len(changes.Updates) > 0 {
221-
gitBatch, err := git.NewBatch(ctx, repo.RepoPath())
221+
gitBatch, err := gitrepo.NewBatch(ctx, repo)
222222
if err != nil {
223223
return err
224224
}

modules/indexer/code/elasticsearch/elasticsearch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (b *Indexer) addDelete(filename string, repo *repo_model.Repository) elasti
210210
func (b *Indexer) Index(ctx context.Context, repo *repo_model.Repository, sha string, changes *internal.RepoChanges) error {
211211
reqs := make([]elastic.BulkableRequest, 0)
212212
if len(changes.Updates) > 0 {
213-
batch, err := git.NewBatch(ctx, repo.RepoPath())
213+
batch, err := gitrepo.NewBatch(ctx, repo)
214214
if err != nil {
215215
return err
216216
}

0 commit comments

Comments
 (0)