Skip to content

Commit 6f2dbe0

Browse files
committed
add context to CheckAtrribute
1 parent 944998d commit 6f2dbe0

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

Diff for: modules/git/repo_attribute.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type CheckAttributeOpts struct {
2424
}
2525

2626
// CheckAttribute return the Blame object of file
27-
func (repo *Repository) CheckAttribute(opts CheckAttributeOpts) (map[string]map[string]string, error) {
27+
func (repo *Repository) CheckAttribute(ctx context.Context, opts CheckAttributeOpts) (map[string]map[string]string, error) {
2828
env := []string{}
2929

3030
if len(opts.IndexFile) > 0 {
@@ -59,7 +59,7 @@ func (repo *Repository) CheckAttribute(opts CheckAttributeOpts) (map[string]map[
5959

6060
cmd.AddDashesAndList(opts.Filenames...)
6161

62-
if err := cmd.Run(repo.Ctx, &RunOpts{
62+
if err := cmd.Run(ctx, &RunOpts{
6363
Env: env,
6464
Dir: repo.Path,
6565
Stdout: stdOut,

Diff for: modules/git/repo_language_stats_nogogit.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
func (repo *Repository) GetLanguageStats(ctx context.Context, commitID string) (map[string]int64, error) {
2222
// We will feed the commit IDs in order into cat-file --batch, followed by blobs as necessary.
2323
// so let's create a batch stdin and stdout
24-
batchStdinWriter, batchReader, cancel, err := repo.CatFileBatch(repo.Ctx)
24+
batchStdinWriter, batchReader, cancel, err := repo.CatFileBatch(ctx)
2525
if err != nil {
2626
return nil, err
2727
}
@@ -80,8 +80,8 @@ func (repo *Repository) GetLanguageStats(ctx context.Context, commitID string) (
8080

8181
for _, f := range entries {
8282
select {
83-
case <-repo.Ctx.Done():
84-
return sizes, repo.Ctx.Err()
83+
case <-ctx.Done():
84+
return sizes, ctx.Err()
8585
default:
8686
}
8787

Diff for: routers/web/repo/setting/lfs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func LFSLocks(ctx *context.Context) {
150150
return
151151
}
152152

153-
name2attribute2info, err := gitRepo.CheckAttribute(git.CheckAttributeOpts{
153+
name2attribute2info, err := gitRepo.CheckAttribute(ctx, git.CheckAttributeOpts{
154154
Attributes: []string{"lockable"},
155155
Filenames: filenames,
156156
CachedOnly: true,

Diff for: services/repository/files/content.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func TryGetContentLanguage(ctx context.Context, gitRepo *git.Repository, commitI
279279

280280
defer deleteTemporaryFile()
281281

282-
filename2attribute2info, err := gitRepo.CheckAttribute(git.CheckAttributeOpts{
282+
filename2attribute2info, err := gitRepo.CheckAttribute(ctx, git.CheckAttributeOpts{
283283
CachedOnly: true,
284284
Attributes: []string{git.AttributeLinguistLanguage, git.AttributeGitlabLanguage},
285285
Filenames: []string{treePath},

Diff for: services/repository/files/update.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func CreateOrUpdateFile(ctx context.Context, t *TemporaryUploadRepository, file
483483
var lfsMetaObject *git_model.LFSMetaObject
484484
if setting.LFS.StartServer && hasOldBranch {
485485
// Check there is no way this can return multiple infos
486-
filename2attribute2info, err := t.gitRepo.CheckAttribute(git.CheckAttributeOpts{
486+
filename2attribute2info, err := t.gitRepo.CheckAttribute(ctx, git.CheckAttributeOpts{
487487
Attributes: []string{"filter"},
488488
Filenames: []string{file.Options.treePath},
489489
CachedOnly: true,

Diff for: services/repository/files/upload.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
107107

108108
var filename2attribute2info map[string]map[string]string
109109
if setting.LFS.StartServer {
110-
filename2attribute2info, err = t.gitRepo.CheckAttribute(git.CheckAttributeOpts{
110+
filename2attribute2info, err = t.gitRepo.CheckAttribute(ctx, git.CheckAttributeOpts{
111111
Attributes: []string{"filter"},
112112
Filenames: names,
113113
CachedOnly: true,

0 commit comments

Comments
 (0)