diff options
Diffstat (limited to 'routers/web/repo/compare.go')
-rw-r--r-- | routers/web/repo/compare.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 3b07c35cb0..22e6be2021 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -6,6 +6,7 @@ package repo import ( "bufio" + gocontext "context" "encoding/csv" "errors" "fmt" @@ -136,14 +137,14 @@ func setCsvCompareContext(ctx *context.Context) { return csvReader, reader, err } - baseReader, baseBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Filename: diffFile.OldName}, baseCommit) + baseReader, baseBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, Filename: diffFile.OldName}, baseCommit) if baseBlobCloser != nil { defer baseBlobCloser.Close() } if err == errTooLarge { return CsvDiffResult{nil, err.Error()} } - headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Filename: diffFile.Name}, headCommit) + headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, Filename: diffFile.Name}, headCommit) if headBlobCloser != nil { defer headBlobCloser.Close() } @@ -382,7 +383,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { ci.HeadRepo = ctx.Repo.Repository ci.HeadGitRepo = ctx.Repo.GitRepo } else if has { - ci.HeadGitRepo, err = git.OpenRepository(ci.HeadRepo.RepoPath()) + ci.HeadGitRepo, err = git.OpenRepositoryCtx(ctx, ci.HeadRepo.RepoPath()) if err != nil { ctx.ServerError("OpenRepository", err) return nil @@ -442,7 +443,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { if canRead { ctx.Data["RootRepo"] = rootRepo if !fileOnly { - branches, tags, err := getBranchesAndTagsForRepo(rootRepo) + branches, tags, err := getBranchesAndTagsForRepo(ctx, rootRepo) if err != nil { ctx.ServerError("GetBranchesForRepo", err) return nil @@ -467,7 +468,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { if canRead { ctx.Data["OwnForkRepo"] = ownForkRepo if !fileOnly { - branches, tags, err := getBranchesAndTagsForRepo(ownForkRepo) + branches, tags, err := getBranchesAndTagsForRepo(ctx, ownForkRepo) if err != nil { ctx.ServerError("GetBranchesForRepo", err) return nil @@ -653,8 +654,8 @@ func PrepareCompareDiff( return false } -func getBranchesAndTagsForRepo(repo *repo_model.Repository) (branches, tags []string, err error) { - gitRepo, err := git.OpenRepository(repo.RepoPath()) +func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repository) (branches, tags []string, err error) { + gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath()) if err != nil { return nil, nil, err } |