mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-11 05:36:25 +00:00
refactor: remove Ctx field from git.Repository (#38500)
This commit is contained in:
@@ -21,7 +21,7 @@ func ShowBranchFeed(ctx *context.Context, repo *repo.Repository, formatType stri
|
||||
var commits []*git.Commit
|
||||
var err error
|
||||
if ctx.Repo.Commit != nil {
|
||||
commits, err = ctx.Repo.Commit.CommitsByRange(ctx.Repo.GitRepo, 0, 10, "", "", "")
|
||||
commits, err = ctx.Repo.Commit.CommitsByRange(ctx, ctx.Repo.GitRepo, 0, 10, "", "", "")
|
||||
if err != nil {
|
||||
ctx.ServerError("ShowBranchFeed", err)
|
||||
return
|
||||
|
||||
@@ -23,7 +23,7 @@ func ShowFileFeed(ctx *context.Context, repo *repo.Repository, formatType string
|
||||
if len(fileName) == 0 {
|
||||
return
|
||||
}
|
||||
commits, _, err := ctx.Repo.GitRepo.CommitsByFileAndRange(
|
||||
commits, _, err := ctx.Repo.GitRepo.CommitsByFileAndRange(ctx,
|
||||
git.CommitsByFileAndRangeOptions{
|
||||
Revision: ctx.Repo.RefFullName.ShortName(), // FIXME: legacy code used ShortName
|
||||
File: fileName,
|
||||
|
||||
@@ -194,7 +194,7 @@ func prepareOrgProfileReadme(ctx *context.Context, prepareResult *shared_user.Pr
|
||||
return false
|
||||
}
|
||||
|
||||
readmeBytes, err := readmeBlob.GetBlobContent(setting.UI.MaxDisplayFileSize)
|
||||
readmeBytes, err := readmeBlob.GetBlobContent(ctx, setting.UI.MaxDisplayFileSize)
|
||||
if err != nil {
|
||||
log.Error("failed to GetBlobContent for profile %q (view as %q) readme: %v", profileRepo.FullName(), viewAs, err)
|
||||
return false
|
||||
|
||||
@@ -87,7 +87,7 @@ func List(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("actions.actions")
|
||||
ctx.Data["PageIsActions"] = true
|
||||
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx, ctx.Repo.Repository.DefaultBranch)
|
||||
if errors.Is(err, util.ErrNotExist) {
|
||||
ctx.Data["NotFoundPrompt"] = ctx.Tr("repo.branch.default_branch_not_exist", ctx.Repo.Repository.DefaultBranch)
|
||||
ctx.NotFound(nil)
|
||||
@@ -181,9 +181,9 @@ func WorkflowDispatchInputs(ctx *context.Context) {
|
||||
var commit *git.Commit
|
||||
var err error
|
||||
if refName.IsTag() {
|
||||
commit, err = ctx.Repo.GitRepo.GetTagCommit(refName.TagName())
|
||||
commit, err = ctx.Repo.GitRepo.GetTagCommit(ctx, refName.TagName())
|
||||
} else if refName.IsBranch() {
|
||||
commit, err = ctx.Repo.GitRepo.GetBranchCommit(refName.BranchName())
|
||||
commit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx, refName.BranchName())
|
||||
} else {
|
||||
ctx.ServerError("UnsupportedRefType", nil)
|
||||
return
|
||||
@@ -215,7 +215,7 @@ func prepareWorkflowTemplate(ctx *context.Context, commit *git.Commit) (workflow
|
||||
workflows = make([]WorkflowInfo, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
workflow := WorkflowInfo{EntryName: entry.Name()}
|
||||
content, err := actions.GetContentFromEntry(ctx.Repo.GitRepo, entry)
|
||||
content, err := actions.GetContentFromEntry(ctx, ctx.Repo.GitRepo, entry)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetContentFromEntry", err)
|
||||
return nil, ""
|
||||
|
||||
@@ -251,7 +251,7 @@ func ViewWorkflowFile(ctx *context_module.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
commit, err := ctx.Repo.GitRepo.GetCommit(run.CommitSHA)
|
||||
commit, err := ctx.Repo.GitRepo.GetCommit(ctx, run.CommitSHA)
|
||||
if err != nil {
|
||||
ctx.NotFoundOrServerError("GetCommit", func(err error) bool {
|
||||
return errors.Is(err, util.ErrNotExist)
|
||||
@@ -1476,14 +1476,14 @@ func viewScopedWorkflowFile(ctx *context_module.Context, run *actions_model.Acti
|
||||
return
|
||||
}
|
||||
|
||||
sourceGitRepo, err := gitrepo.OpenRepository(ctx, sourceRepo)
|
||||
sourceGitRepo, err := gitrepo.OpenRepository(sourceRepo)
|
||||
if err != nil {
|
||||
ctx.ServerError("OpenRepository", err)
|
||||
return
|
||||
}
|
||||
defer sourceGitRepo.Close()
|
||||
|
||||
commit, err := sourceGitRepo.GetCommit(run.WorkflowCommitSHA)
|
||||
commit, err := sourceGitRepo.GetCommit(ctx, run.WorkflowCommitSHA)
|
||||
if err != nil {
|
||||
ctx.NotFoundOrServerError("GetCommit", func(err error) bool {
|
||||
return errors.Is(err, util.ErrNotExist)
|
||||
|
||||
@@ -57,7 +57,7 @@ func RefBlame(ctx *context.Context) {
|
||||
}
|
||||
|
||||
blob := entry.Blob(ctx.Repo.GitRepo)
|
||||
fileSize := blob.Size()
|
||||
fileSize := blob.Size(ctx)
|
||||
ctx.Data["FileSize"] = fileSize
|
||||
ctx.Data["FileTreePath"] = ctx.Repo.TreePath
|
||||
|
||||
@@ -73,7 +73,7 @@ func RefBlame(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["NumLines"], err = blob.GetBlobLineCount(nil)
|
||||
ctx.Data["NumLines"], err = blob.GetBlobLineCount(ctx, nil)
|
||||
if err != nil {
|
||||
ctx.NotFound(err)
|
||||
return
|
||||
@@ -197,7 +197,7 @@ func processBlameParts(ctx *context.Context, blameParts []*gitrepo.BlamePart) ma
|
||||
commit, ok := commitCache[sha]
|
||||
var err error
|
||||
if !ok {
|
||||
commit, err = ctx.Repo.GitRepo.GetCommit(sha)
|
||||
commit, err = ctx.Repo.GitRepo.GetCommit(ctx, sha)
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound(err)
|
||||
|
||||
@@ -198,9 +198,9 @@ func CreateBranch(ctx *context.Context) {
|
||||
}
|
||||
err = release_service.CreateNewTag(ctx, ctx.Doer, ctx.Repo.Repository, target, form.NewBranchName, "")
|
||||
} else if ctx.Repo.RefFullName.IsBranch() {
|
||||
err = repo_service.CreateNewBranch(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.BranchName, form.NewBranchName)
|
||||
err = repo_service.CreateNewBranch(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.Repo.BranchName, form.NewBranchName)
|
||||
} else {
|
||||
err = repo_service.CreateNewBranchFromCommit(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.CommitID, form.NewBranchName)
|
||||
err = repo_service.CreateNewBranchFromCommit(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.Repo.CommitID, form.NewBranchName)
|
||||
}
|
||||
if err != nil {
|
||||
if release_service.IsErrProtectedTagName(err) {
|
||||
|
||||
@@ -76,7 +76,7 @@ func Commits(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// Both `git log branchName` and `git log commitId` work.
|
||||
commits, err := ctx.Repo.Commit.CommitsByRange(ctx.Repo.GitRepo, page, pageSize, "", "", "")
|
||||
commits, err := ctx.Repo.Commit.CommitsByRange(ctx, ctx.Repo.GitRepo, page, pageSize, "", "", "")
|
||||
if err != nil {
|
||||
ctx.ServerError("CommitsByRange", err)
|
||||
return
|
||||
@@ -141,7 +141,7 @@ func Graph(ctx *context.Context) {
|
||||
|
||||
page := ctx.FormInt("page")
|
||||
|
||||
graph, err := gitgraph.GetCommitGraph(ctx.Repo.GitRepo, page, 0, hidePRRefs, realBranches, files)
|
||||
graph, err := gitgraph.GetCommitGraph(ctx, ctx.Repo.GitRepo, page, 0, hidePRRefs, realBranches, files)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommitGraph", err)
|
||||
return
|
||||
@@ -154,7 +154,7 @@ func Graph(ctx *context.Context) {
|
||||
|
||||
ctx.Data["Graph"] = graph
|
||||
|
||||
gitRefs, err := ctx.Repo.GitRepo.GetRefs()
|
||||
gitRefs, err := ctx.Repo.GitRepo.GetRefs(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("GitRepo.GetRefs", err)
|
||||
return
|
||||
@@ -189,7 +189,7 @@ func SearchCommits(ctx *context.Context) {
|
||||
|
||||
all := ctx.FormBool("all")
|
||||
opts := git.NewSearchCommitsOptions(query, all)
|
||||
commits, err := ctx.Repo.Commit.SearchCommits(ctx.Repo.GitRepo, opts)
|
||||
commits, err := ctx.Repo.Commit.SearchCommits(ctx, ctx.Repo.GitRepo, opts)
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchCommits", err)
|
||||
return
|
||||
@@ -220,7 +220,7 @@ func FileHistory(ctx *context.Context) {
|
||||
ctx.Data["FollowRenameChecked"] = followRename
|
||||
|
||||
page := max(ctx.FormInt("page"), 1)
|
||||
commits, hasMore, err := ctx.Repo.GitRepo.CommitsByFileAndRange(
|
||||
commits, hasMore, err := ctx.Repo.GitRepo.CommitsByFileAndRange(ctx,
|
||||
git.CommitsByFileAndRangeOptions{
|
||||
Revision: ctx.Repo.RefFullName.ShortName(), // FIXME: legacy code used ShortName
|
||||
File: ctx.Repo.TreePath,
|
||||
@@ -302,7 +302,7 @@ func Diff(ctx *context.Context) {
|
||||
diffBlobExcerptData.BaseLink = ctx.Repo.RepoLink + "/wiki/blob_excerpt"
|
||||
}
|
||||
|
||||
commit, err := gitRepo.GetCommit(commitID)
|
||||
commit, err := gitRepo.GetCommit(ctx, commitID)
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound(err)
|
||||
@@ -357,7 +357,7 @@ func Diff(ctx *context.Context) {
|
||||
var parentCommit *git.Commit
|
||||
var parentCommitID string
|
||||
if commit.ParentCount() > 0 {
|
||||
parentCommit, err = gitRepo.GetCommit(parents[0])
|
||||
parentCommit, err = gitRepo.GetCommit(ctx, parents[0])
|
||||
if err != nil {
|
||||
ctx.NotFound(err)
|
||||
return
|
||||
@@ -433,7 +433,7 @@ func Diff(ctx *context.Context) {
|
||||
func RawDiff(ctx *context.Context) {
|
||||
var gitRepo *git.Repository
|
||||
if ctx.Data["PageIsWiki"] != nil {
|
||||
wikiRepo, err := gitrepo.OpenRepository(ctx, ctx.Repo.Repository.WikiStorageRepo())
|
||||
wikiRepo, err := gitrepo.OpenRepository(ctx.Repo.Repository.WikiStorageRepo())
|
||||
if err != nil {
|
||||
ctx.ServerError("OpenRepository", err)
|
||||
return
|
||||
@@ -447,7 +447,7 @@ func RawDiff(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := git.GetRawDiff(
|
||||
if err := git.GetRawDiff(ctx,
|
||||
gitRepo,
|
||||
ctx.PathParam("sha"),
|
||||
git.RawDiffType(ctx.PathParam("ext")),
|
||||
|
||||
+11
-11
@@ -75,7 +75,7 @@ func setCompareContext(ctx *context.Context, before, head *git.Commit, headOwner
|
||||
return st
|
||||
}
|
||||
|
||||
st, err := blob.GuessContentType()
|
||||
st, err := blob.GuessContentType(ctx)
|
||||
if err != nil {
|
||||
log.Error("GuessContentType failed: %v", err)
|
||||
return st
|
||||
@@ -140,11 +140,11 @@ func setCsvCompareContext(ctx *context.Context) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
if setting.UI.CSV.MaxFileSize != 0 && setting.UI.CSV.MaxFileSize < blob.Size() {
|
||||
if setting.UI.CSV.MaxFileSize != 0 && setting.UI.CSV.MaxFileSize < blob.Size(ctx) {
|
||||
return nil, nil, errTooLarge
|
||||
}
|
||||
|
||||
reader, err := blob.DataAsync()
|
||||
reader, err := blob.DataAsync(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -236,7 +236,7 @@ func (cpi *comparePageInfoType) parseCompareInfo(ctx *context.Context, comparePa
|
||||
baseRefName := util.IfZero(compareReq.BaseOriRef, baseRepo.GetPullRequestTargetBranch(ctx))
|
||||
headRefName := util.IfZero(compareReq.HeadOriRef, headRepo.DefaultBranch)
|
||||
|
||||
baseRef, err := common.ResolveRefWithSuffix(ctx.Repo.GitRepo, baseRefName, compareReq.BaseOriRefSuffix)
|
||||
baseRef, err := common.ResolveRefWithSuffix(ctx, ctx.Repo.GitRepo, baseRefName, compareReq.BaseOriRefSuffix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -245,7 +245,7 @@ func (cpi *comparePageInfoType) parseCompareInfo(ctx *context.Context, comparePa
|
||||
return err
|
||||
}
|
||||
|
||||
headRef, err := common.ResolveRefWithSuffix(headGitRepo, headRefName, compareReq.HeadOriRefSuffix)
|
||||
headRef, err := common.ResolveRefWithSuffix(ctx, headGitRepo, headRefName, compareReq.HeadOriRefSuffix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -496,7 +496,7 @@ func (cpi *comparePageInfoType) prepareCompareDiff(ctx *context.Context, whitesp
|
||||
ctx.Data["FileIconPoolHTML"] = renderedIconPool.RenderToHTML()
|
||||
}
|
||||
|
||||
headCommit, err := ci.HeadGitRepo.GetCommit(headCommitID)
|
||||
headCommit, err := ci.HeadGitRepo.GetCommit(ctx, headCommitID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommit", err)
|
||||
return
|
||||
@@ -504,7 +504,7 @@ func (cpi *comparePageInfoType) prepareCompareDiff(ctx *context.Context, whitesp
|
||||
|
||||
baseGitRepo := ctx.Repo.GitRepo
|
||||
|
||||
beforeCommit, err := baseGitRepo.GetCommit(beforeCommitID)
|
||||
beforeCommit, err := baseGitRepo.GetCommit(ctx, beforeCommitID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommit", err)
|
||||
return
|
||||
@@ -631,9 +631,9 @@ func downloadCompareDiffOrPatch(ctx *context.Context, patch bool) {
|
||||
|
||||
var err error
|
||||
if patch {
|
||||
err = ci.HeadGitRepo.GetPatch(compareArg, ctx.Resp)
|
||||
err = ci.HeadGitRepo.GetPatch(ctx, compareArg, ctx.Resp)
|
||||
} else {
|
||||
err = ci.HeadGitRepo.GetDiff(compareArg, ctx.Resp)
|
||||
err = ci.HeadGitRepo.GetDiff(ctx, compareArg, ctx.Resp)
|
||||
}
|
||||
if err != nil {
|
||||
ctx.ServerError("DownloadCompareDiffOrPatch", err)
|
||||
@@ -768,7 +768,7 @@ func ExcerptBlob(ctx *context.Context) {
|
||||
diffBlobExcerptData.BaseLink = ctx.Repo.RepoLink + "/wiki/blob_excerpt"
|
||||
}
|
||||
|
||||
commit, err := gitRepo.GetCommit(commitID)
|
||||
commit, err := gitRepo.GetCommit(ctx, commitID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommit", err)
|
||||
return
|
||||
@@ -778,7 +778,7 @@ func ExcerptBlob(ctx *context.Context) {
|
||||
ctx.ServerError("GetBlobByPath", err)
|
||||
return
|
||||
}
|
||||
reader, err := blob.DataAsync()
|
||||
reader, err := blob.DataAsync(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("DataAsync", err)
|
||||
return
|
||||
|
||||
@@ -30,7 +30,7 @@ func ServeBlobOrLFS(ctx *context.Context, blob *git.Blob, lastModified *time.Tim
|
||||
return nil
|
||||
}
|
||||
|
||||
lfsPointerBuf, err := blob.GetBlobBytes(lfs.MetaFileMaxSize)
|
||||
lfsPointerBuf, err := blob.GetBlobBytes(ctx, lfs.MetaFileMaxSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func getBlobForEntry(ctx *context.Context) (*git.Blob, *time.Time) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
latestCommit, err := ctx.Repo.GitRepo.GetTreePathLatestCommit(ctx.Repo.Commit.ID.String(), ctx.Repo.TreePath)
|
||||
latestCommit, err := ctx.Repo.GitRepo.GetTreePathLatestCommit(ctx, ctx.Repo.Commit.ID.String(), ctx.Repo.TreePath)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetTreePathLatestCommit", err)
|
||||
return nil, nil
|
||||
|
||||
@@ -23,7 +23,7 @@ func CherryPick(ctx *context.Context) {
|
||||
|
||||
fromCommitID := ctx.PathParam("sha")
|
||||
ctx.Data["FromCommitID"] = fromCommitID
|
||||
cherryPickCommit, err := ctx.Repo.GitRepo.GetCommit(fromCommitID)
|
||||
cherryPickCommit, err := ctx.Repo.GitRepo.GetCommit(ctx, fromCommitID)
|
||||
if err != nil {
|
||||
HandleGitError(ctx, "GetCommit", err)
|
||||
return
|
||||
@@ -66,7 +66,7 @@ func CherryPickPost(ctx *context.Context) {
|
||||
if parsed.form.Revert {
|
||||
err = gitrepo.GetReverseRawDiff(ctx, ctx.Repo.Repository, fromCommitID, buf)
|
||||
} else {
|
||||
err = git.GetRawDiff(ctx.Repo.GitRepo, fromCommitID, git.RawDiffPatch, buf)
|
||||
err = git.GetRawDiff(ctx, ctx.Repo.GitRepo, fromCommitID, git.RawDiffPatch, buf)
|
||||
}
|
||||
if err == nil {
|
||||
opts.Content = buf.String()
|
||||
|
||||
@@ -28,7 +28,7 @@ func DiffPreviewPost(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
oldContent, err := entry.Blob(ctx.Repo.GitRepo).GetBlobContent(setting.UI.MaxDisplayFileSize)
|
||||
oldContent, err := entry.Blob(ctx.Repo.GitRepo).GetBlobContent(ctx, setting.UI.MaxDisplayFileSize)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetBlobContent", err)
|
||||
return
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestEditorUtils(t *testing.T) {
|
||||
assert.Equal(t, "user2-patch-1", branchName)
|
||||
})
|
||||
t.Run("getClosestParentWithFiles", func(t *testing.T) {
|
||||
gitRepo, _ := gitrepo.OpenRepository(t.Context(), repo)
|
||||
gitRepo, _ := gitrepo.OpenRepository(repo)
|
||||
defer gitRepo.Close()
|
||||
treePath := getClosestParentWithFiles(t.Context(), gitRepo, "sub-home-md-img-check", "docs/foo/bar")
|
||||
assert.Equal(t, "docs", treePath)
|
||||
|
||||
@@ -57,7 +57,7 @@ func getClosestParentWithFiles(ctx context.Context, gitRepo *git.Repository, bra
|
||||
}
|
||||
return treePath
|
||||
}
|
||||
commit, err := gitRepo.GetBranchCommit(branchName) // must get the commit again to get the latest change
|
||||
commit, err := gitRepo.GetBranchCommit(ctx, branchName) // must get the commit again to get the latest change
|
||||
if err != nil {
|
||||
log.Error("GetBranchCommit: %v", err)
|
||||
return ""
|
||||
|
||||
@@ -38,7 +38,7 @@ import (
|
||||
|
||||
// Tries to load and set an issue template. The first return value indicates if a template was loaded.
|
||||
func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles []string, metaData *IssuePageMetaData) (bool, map[string]error) {
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx, ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ func GetPullDiffStats(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
|
||||
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(pull.GetGitHeadRefName())
|
||||
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(ctx, pull.GetGitHeadRefName())
|
||||
if errors.Is(err, util.ErrNotExist) {
|
||||
return
|
||||
} else if err != nil {
|
||||
@@ -227,7 +227,7 @@ func GetMergedBaseCommitID(ctx *context.Context, issue *issues_model.Issue) stri
|
||||
if pull.MergeBase == "" {
|
||||
var commitSHA, parentCommit string
|
||||
// If there is a head or a patch file, and it is readable, grab info
|
||||
commitSHA, err := ctx.Repo.GitRepo.GetRefCommitID(pull.GetGitHeadRefName())
|
||||
commitSHA, err := ctx.Repo.GitRepo.GetRefCommitID(ctx, pull.GetGitHeadRefName())
|
||||
if err != nil {
|
||||
// Head File does not exist, try the patch
|
||||
commitSHA, err = ctx.Repo.GitRepo.ReadPatchCommit(pull.Index)
|
||||
@@ -555,13 +555,13 @@ func getViewPullHeadBranchCommitID(ctx *context.Context, pull *issues_model.Pull
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return headGitRepo.GetRefCommitID(git.RefNameFromBranch(pull.HeadBranch).String())
|
||||
return headGitRepo.GetRefCommitID(ctx, git.RefNameFromBranch(pull.HeadBranch).String())
|
||||
case issues_model.PullRequestFlowAGit:
|
||||
baseGitRepo, err := gitrepo.RepositoryFromRequestContextOrOpen(ctx, pull.BaseRepo)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return baseGitRepo.GetRefCommitID(pull.GetGitHeadRefName())
|
||||
return baseGitRepo.GetRefCommitID(ctx, pull.GetGitHeadRefName())
|
||||
}
|
||||
setting.PanicInDevOrTesting("invalid pull request flow type: %v", pull.Flow)
|
||||
return "", util.ErrNotExist
|
||||
@@ -731,7 +731,7 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
|
||||
afterCommitID = util.IfZero(afterCommitID, headCommitID)
|
||||
afterCommit := indexCommit(prCompareInfo.Commits, afterCommitID)
|
||||
if afterCommit == nil && afterCommitID == headCommitID {
|
||||
afterCommit, err = gitRepo.GetCommit(afterCommitID)
|
||||
afterCommit, err = gitRepo.GetCommit(ctx, afterCommitID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommit(afterCommitID)", err)
|
||||
return
|
||||
@@ -744,7 +744,7 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
|
||||
|
||||
var beforeCommit *git.Commit
|
||||
if isSingleCommit {
|
||||
beforeCommit, err = afterCommit.Parent(ctx.Repo.GitRepo, 0)
|
||||
beforeCommit, err = afterCommit.Parent(ctx, ctx.Repo.GitRepo, 0)
|
||||
if err != nil {
|
||||
ctx.ServerError("afterCommit.Parent", err)
|
||||
return
|
||||
@@ -755,7 +755,7 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
|
||||
beforeCommit = indexCommit(prCompareInfo.Commits, beforeCommitID)
|
||||
if beforeCommit == nil && beforeCommitID == prCompareInfo.CompareBase {
|
||||
// base commit is not in the list of the pull request commits
|
||||
beforeCommit, err = gitRepo.GetCommit(beforeCommitID)
|
||||
beforeCommit, err = gitRepo.GetCommit(ctx, beforeCommitID)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommit(beforeCommitID)", err)
|
||||
return
|
||||
|
||||
@@ -49,7 +49,7 @@ func RenderNewCodeCommentForm(ctx *context.Context) {
|
||||
ctx.Data["PageIsPullFiles"] = true
|
||||
ctx.Data["Issue"] = issue
|
||||
ctx.Data["CurrentReview"] = currentReview
|
||||
pullHeadCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(issue.PullRequest.GetGitHeadRefName())
|
||||
pullHeadCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(ctx, issue.PullRequest.GetGitHeadRefName())
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRefCommitID", err)
|
||||
return
|
||||
@@ -199,7 +199,7 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
|
||||
ctx.ServerError("comment.Issue.LoadPullRequest", err)
|
||||
return
|
||||
}
|
||||
pullHeadCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(comment.Issue.PullRequest.GetGitHeadRefName())
|
||||
pullHeadCommitID, err := ctx.Repo.GitRepo.GetRefCommitID(ctx, comment.Issue.PullRequest.GetGitHeadRefName())
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRefCommitID", err)
|
||||
return
|
||||
|
||||
@@ -47,7 +47,7 @@ func calReleaseNumCommitsBehind(ctx stdCtx.Context, repoCtx *context.Repository,
|
||||
}
|
||||
// Get count if not cached
|
||||
if _, ok := countCache[target]; !ok {
|
||||
commit, err := repoCtx.GitRepo.GetBranchCommit(target)
|
||||
commit, err := repoCtx.GitRepo.GetBranchCommit(ctx, target)
|
||||
if err != nil {
|
||||
var errNotExist git.ErrNotExist
|
||||
if target == repoCtx.Repository.DefaultBranch || !errors.As(err, &errNotExist) {
|
||||
@@ -55,7 +55,7 @@ func calReleaseNumCommitsBehind(ctx stdCtx.Context, repoCtx *context.Repository,
|
||||
}
|
||||
// fallback to default branch
|
||||
target = repoCtx.Repository.DefaultBranch
|
||||
commit, err = repoCtx.GitRepo.GetBranchCommit(target)
|
||||
commit, err = repoCtx.GitRepo.GetBranchCommit(ctx, target)
|
||||
if err != nil {
|
||||
return fmt.Errorf("GetBranchCommit(DefaultBranch): %w", err)
|
||||
}
|
||||
@@ -500,7 +500,7 @@ func NewReleasePost(ctx *context.Context) {
|
||||
IsPrerelease: form.Prerelease,
|
||||
IsTag: false,
|
||||
}
|
||||
if err = release_service.CreateRelease(ctx.Repo.GitRepo, rel, attachmentUUIDs, newTagMsg); err != nil {
|
||||
if err = release_service.CreateRelease(ctx, ctx.Repo.GitRepo, rel, attachmentUUIDs, newTagMsg); err != nil {
|
||||
handleTagReleaseError(err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ func RenderFile(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
blobReader, err := blob.DataAsync()
|
||||
blobReader, err := blob.DataAsync(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("DataAsync", err)
|
||||
return
|
||||
|
||||
@@ -351,7 +351,7 @@ func Download(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.PathParam("*"), ctx.FormStrings("path"))
|
||||
aReq, err := archiver_service.NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.PathParam("*"), ctx.FormStrings("path"))
|
||||
if err != nil {
|
||||
if errors.Is(err, util.ErrInvalidArgument) {
|
||||
ctx.HTTPError(http.StatusBadRequest, err.Error())
|
||||
@@ -387,7 +387,7 @@ func InitiateDownload(ctx *context.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.PathParam("*"), paths)
|
||||
aReq, err := archiver_service.NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.PathParam("*"), paths)
|
||||
if err != nil {
|
||||
ctx.HTTPError(http.StatusBadRequest, "invalid archive request")
|
||||
return
|
||||
|
||||
@@ -122,7 +122,7 @@ func LFSLocks(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
gitRepo, err := git.OpenRepository(ctx, tmpBasePath)
|
||||
gitRepo, err := git.OpenRepository(tmpBasePath)
|
||||
if err != nil {
|
||||
log.Error("Unable to open temporary repository: %s (%v)", tmpBasePath, err)
|
||||
ctx.ServerError("LFSLocks", fmt.Errorf("failed to open new temporary repository in: %s %w", tmpBasePath, err))
|
||||
@@ -130,7 +130,7 @@ func LFSLocks(ctx *context.Context) {
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
checker, err := attribute.NewBatchChecker(gitRepo, ctx.Repo.Repository.DefaultBranch, []string{attribute.Lockable})
|
||||
checker, err := attribute.NewBatchChecker(ctx, gitRepo, ctx.Repo.Repository.DefaultBranch, []string{attribute.Lockable})
|
||||
if err != nil {
|
||||
log.Error("Unable to check attributes in %s (%v)", tmpBasePath, err)
|
||||
ctx.ServerError("LFSLocks", err)
|
||||
@@ -151,7 +151,7 @@ func LFSLocks(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["Lockables"] = lockables
|
||||
|
||||
filelist, err := gitRepo.LsFiles(filenames...)
|
||||
filelist, err := gitRepo.LsFiles(ctx, filenames...)
|
||||
if err != nil {
|
||||
log.Error("Unable to lsfiles in %s (%v)", tmpBasePath, err)
|
||||
ctx.ServerError("LFSLocks", err)
|
||||
@@ -383,7 +383,7 @@ func LFSFileFind(ctx *context.Context) {
|
||||
ctx.Data["Size"] = size
|
||||
ctx.Data["SHA"] = sha
|
||||
|
||||
results, err := pipeline.FindLFSFile(ctx.Repo.GitRepo, objectID)
|
||||
results, err := pipeline.FindLFSFile(ctx, ctx.Repo.GitRepo, objectID)
|
||||
if err != nil && err != io.EOF {
|
||||
log.Error("Failure in FindLFSFile: %v", err)
|
||||
ctx.ServerError("LFSFind: FindLFSFile.", err)
|
||||
|
||||
@@ -69,7 +69,7 @@ func SettingsCtxData(ctx *context.Context) {
|
||||
ctx.Data["MinimumMirrorInterval"] = setting.Mirror.MinInterval
|
||||
ctx.Data["CanConvertFork"] = ctx.Repo.Repository.IsFork && ctx.Doer.CanCreateRepoIn(ctx.Repo.Repository.Owner)
|
||||
|
||||
signing, _ := gitrepo.GetSigningKey(ctx)
|
||||
signing, _ := git.GetSigningKey(ctx)
|
||||
ctx.Data["SigningKeyAvailable"] = signing != nil
|
||||
ctx.Data["SigningSettings"] = setting.Repository.Signing
|
||||
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
|
||||
@@ -147,7 +147,7 @@ func SettingsPost(ctx *context.Context) {
|
||||
ctx.Data["DefaultMirrorInterval"] = setting.Mirror.DefaultInterval
|
||||
ctx.Data["MinimumMirrorInterval"] = setting.Mirror.MinInterval
|
||||
|
||||
signing, _ := gitrepo.GetSigningKey(ctx)
|
||||
signing, _ := git.GetSigningKey(ctx)
|
||||
ctx.Data["SigningKeyAvailable"] = signing != nil
|
||||
ctx.Data["SigningSettings"] = setting.Repository.Signing
|
||||
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
|
||||
|
||||
@@ -70,7 +70,7 @@ func (fi *fileInfo) isLFSFile() bool {
|
||||
}
|
||||
|
||||
func getFileReader(ctx gocontext.Context, repoID int64, blob *git.Blob) (buf []byte, dataRc io.ReadCloser, fi *fileInfo, err error) {
|
||||
dataRc, err = blob.DataAsync()
|
||||
dataRc, err = blob.DataAsync(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -81,7 +81,7 @@ func getFileReader(ctx gocontext.Context, repoID int64, blob *git.Blob) (buf []b
|
||||
n, _ := util.ReadAtMost(dataRc, buf)
|
||||
buf = buf[:n]
|
||||
|
||||
fi = &fileInfo{blobOrLfsSize: blob.Size(), st: typesniffer.DetectContentType(buf)}
|
||||
fi = &fileInfo{blobOrLfsSize: blob.Size(ctx), st: typesniffer.DetectContentType(buf)}
|
||||
|
||||
// FIXME: what happens when README file is an image?
|
||||
if !fi.st.IsText() || !setting.LFS.StartServer {
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func prepareLatestCommitInfo(ctx *context.Context) bool {
|
||||
commit, err := ctx.Repo.Commit.GetCommitByPath(ctx.Repo.GitRepo, ctx.Repo.TreePath)
|
||||
commit, err := ctx.Repo.Commit.GetCommitByPath(ctx, ctx.Repo.GitRepo, ctx.Repo.TreePath)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommitByPath", err)
|
||||
return false
|
||||
@@ -182,7 +182,7 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {
|
||||
ctx.Data["FileError"] = strings.TrimSpace(issueConfigErr.Error())
|
||||
}
|
||||
} else if actions.IsWorkflow(ctx.Repo.TreePath) {
|
||||
content, err := actions.GetContentFromEntry(ctx.Repo.GitRepo, entry)
|
||||
content, err := actions.GetContentFromEntry(ctx, ctx.Repo.GitRepo, entry)
|
||||
if err != nil {
|
||||
log.Error("actions.GetContentFromEntry: %v", err)
|
||||
}
|
||||
@@ -190,7 +190,7 @@ func prepareFileView(ctx *context.Context, entry *git.TreeEntry) {
|
||||
ctx.Data["FileError"] = ctx.Locale.Tr("actions.runs.invalid_workflow_helper", workFlowErr.Error())
|
||||
}
|
||||
} else if issue_service.IsCodeOwnerFile(ctx.Repo.TreePath) {
|
||||
if data, err := blob.GetBlobContent(setting.UI.MaxDisplayFileSize); err == nil {
|
||||
if data, err := blob.GetBlobContent(ctx, setting.UI.MaxDisplayFileSize); err == nil {
|
||||
_, warnings := issue_model.GetCodeOwnersFromContent(ctx, data)
|
||||
if len(warnings) > 0 {
|
||||
ctx.Data["FileWarning"] = strings.Join(warnings, "\n")
|
||||
|
||||
@@ -37,7 +37,7 @@ func checkOutdatedBranch(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// get the head commit of the branch since ctx.Repo.CommitID is not always the head commit of `ctx.Repo.BranchName`
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.BranchName)
|
||||
commit, err := ctx.Repo.GitRepo.GetBranchCommit(ctx, ctx.Repo.BranchName)
|
||||
if err != nil {
|
||||
log.Error("GetBranchCommitID: %v", err)
|
||||
// Don't return an error page, as it can be rechecked the next time the user opens the page.
|
||||
@@ -119,7 +119,7 @@ func prepareHomeSidebarCitationFile(entry *git.TreeEntry) func(ctx *context.Cont
|
||||
for _, entry := range allEntries {
|
||||
if entry.Name() == "CITATION.cff" || entry.Name() == "CITATION.bib" {
|
||||
// Read Citation file contents
|
||||
if content, err := entry.Blob(ctx.Repo.GitRepo).GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil {
|
||||
if content, err := entry.Blob(ctx.Repo.GitRepo).GetBlobContent(ctx, setting.UI.MaxDisplayFileSize); err != nil {
|
||||
log.Error("checkCitationFile: GetBlobContent: %v", err)
|
||||
} else {
|
||||
ctx.Data["CitiationExist"] = true
|
||||
@@ -226,7 +226,7 @@ func handleRepoEmptyOrBroken(ctx *context.Context) {
|
||||
ctx.Repo.GitRepo, _ = gitrepo.RepositoryFromRequestContextOrOpen(ctx, ctx.Repo.Repository)
|
||||
}
|
||||
if ctx.Repo.GitRepo != nil {
|
||||
reallyEmpty, err := ctx.Repo.GitRepo.IsEmpty()
|
||||
reallyEmpty, err := ctx.Repo.GitRepo.IsEmpty(ctx)
|
||||
if err != nil {
|
||||
showEmpty = true // the repo is broken
|
||||
updateContextRepoEmptyAndStatus(ctx, true, repo_model.RepositoryBroken)
|
||||
@@ -235,7 +235,7 @@ func handleRepoEmptyOrBroken(ctx *context.Context) {
|
||||
} else if reallyEmpty {
|
||||
showEmpty = true // the repo is really empty
|
||||
updateContextRepoEmptyAndStatus(ctx, true, repo_model.RepositoryReady)
|
||||
} else if branches, _, _ := ctx.Repo.GitRepo.GetBranchNames(0, 1); len(branches) == 0 {
|
||||
} else if branches, _, _ := ctx.Repo.GitRepo.GetBranchNames(ctx, 0, 1); len(branches) == 0 {
|
||||
showEmpty = true // it is not really empty, but there is no branch
|
||||
// at the moment, other repo units like "actions" are not able to handle such case,
|
||||
// so we just mark the repo as empty to prevent from displaying these units.
|
||||
|
||||
@@ -92,7 +92,7 @@ func findReadmeFileInEntries(ctx *context.Context, parentDir string, entries []*
|
||||
if subTreeEntry == nil {
|
||||
continue
|
||||
}
|
||||
subTree := subTreeEntry.Tree(ctx.Repo.GitRepo)
|
||||
subTree := subTreeEntry.Tree(ctx, ctx.Repo.GitRepo)
|
||||
if subTree == nil {
|
||||
// this should be impossible; if subTreeEntry exists so should this.
|
||||
continue
|
||||
|
||||
@@ -41,11 +41,11 @@ data 12
|
||||
err = gitcmd.NewCommand("fast-import").WithDir(repoPath).WithStdinBytes([]byte(stdin)).RunWithStderr(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
gitRepo, err := git.OpenRepository(t.Context(), repoPath)
|
||||
gitRepo, err := git.OpenRepository(repoPath)
|
||||
require.NoError(t, err)
|
||||
defer gitRepo.Close()
|
||||
|
||||
commit, err := gitRepo.GetBranchCommit("master")
|
||||
commit, err := gitRepo.GetBranchCommit(t.Context(), "master")
|
||||
require.NoError(t, err)
|
||||
|
||||
entries, err := commit.Tree().ListEntries(t.Context(), gitRepo)
|
||||
|
||||
@@ -103,7 +103,7 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err
|
||||
return nil, nil, errGitRepo
|
||||
}
|
||||
|
||||
commit, errCommit := wikiGitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultWikiBranch)
|
||||
commit, errCommit := wikiGitRepo.GetBranchCommit(ctx, ctx.Repo.Repository.DefaultWikiBranch)
|
||||
if git.IsErrNotExist(errCommit) {
|
||||
// if the default branch recorded in database is out of sync, then re-sync it
|
||||
gitRepoDefaultBranch, errBranch := gitrepo.GetDefaultBranch(ctx, ctx.Repo.Repository.WikiStorageRepo())
|
||||
@@ -117,7 +117,7 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err
|
||||
}
|
||||
ctx.Repo.Repository.DefaultWikiBranch = gitRepoDefaultBranch
|
||||
// retry to get the commit from the correct default branch
|
||||
commit, errCommit = wikiGitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultWikiBranch)
|
||||
commit, errCommit = wikiGitRepo.GetBranchCommit(ctx, ctx.Repo.Repository.DefaultWikiBranch)
|
||||
}
|
||||
if errCommit != nil {
|
||||
return wikiGitRepo, nil, errCommit
|
||||
@@ -128,7 +128,7 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err
|
||||
// wikiContentsByEntry returns the contents of the wiki page referenced by the
|
||||
// given tree entry. Writes to ctx if an error occurs.
|
||||
func wikiContentsByEntry(ctx *context.Context, wikiRepo *git.Repository, entry *git.TreeEntry) []byte {
|
||||
reader, err := entry.Blob(wikiRepo).DataAsync()
|
||||
reader, err := entry.Blob(wikiRepo).DataAsync(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("Blob.Data", err)
|
||||
return nil
|
||||
@@ -352,7 +352,7 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry)
|
||||
page := max(ctx.FormInt("page"), 1)
|
||||
|
||||
// get Commit Count
|
||||
commitsHistory, _, err := wikiGitRepo.CommitsByFileAndRange(
|
||||
commitsHistory, _, err := wikiGitRepo.CommitsByFileAndRange(ctx,
|
||||
git.CommitsByFileAndRangeOptions{
|
||||
Revision: ctx.Repo.Repository.DefaultWikiBranch,
|
||||
File: pageFilename,
|
||||
@@ -492,7 +492,7 @@ func Wiki(ctx *context.Context) {
|
||||
ctx.Data["FormatWarning"] = "File extension " + path.Ext(wikiPath) + " is not supported at the moment. Rendered as Markdown."
|
||||
}
|
||||
// Get last change information.
|
||||
lastCommit, err := wikiGitRepo.GetCommitByPath(wikiPath)
|
||||
lastCommit, err := wikiGitRepo.GetCommitByPath(ctx, wikiPath)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommitByPath", err)
|
||||
return
|
||||
@@ -524,7 +524,7 @@ func WikiRevision(ctx *context.Context) {
|
||||
|
||||
// Get last change information.
|
||||
wikiPath := entry.Name()
|
||||
lastCommit, err := wikiGitRepo.GetCommitByPath(wikiPath)
|
||||
lastCommit, err := wikiGitRepo.GetCommitByPath(ctx, wikiPath)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetCommitByPath", err)
|
||||
return
|
||||
|
||||
@@ -29,12 +29,12 @@ const (
|
||||
)
|
||||
|
||||
func wikiEntry(t *testing.T, repo *repo_model.Repository, wikiName wiki_service.WebPath) (*git.Repository, *git.TreeEntry) {
|
||||
wikiRepo, err := gitrepo.OpenRepository(t.Context(), repo.WikiStorageRepo())
|
||||
wikiRepo, err := gitrepo.OpenRepository(repo.WikiStorageRepo())
|
||||
assert.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
defer wikiRepo.Close()
|
||||
})
|
||||
commit, err := wikiRepo.GetBranchCommit("master")
|
||||
commit, err := wikiRepo.GetBranchCommit(t.Context(), "master")
|
||||
assert.NoError(t, err)
|
||||
entries, err := commit.Tree().ListEntries(t.Context(), wikiRepo)
|
||||
assert.NoError(t, err)
|
||||
@@ -51,7 +51,7 @@ func wikiContent(t *testing.T, repo *repo_model.Repository, wikiName wiki_servic
|
||||
if !assert.NotNil(t, entry) {
|
||||
return ""
|
||||
}
|
||||
reader, err := entry.Blob(wikiRepo).DataAsync()
|
||||
reader, err := entry.Blob(wikiRepo).DataAsync(t.Context())
|
||||
assert.NoError(t, err)
|
||||
defer reader.Close()
|
||||
bytes, err := io.ReadAll(reader)
|
||||
|
||||
@@ -116,7 +116,7 @@ func FindOwnerProfileReadme(ctx *context.Context, doer *user_model.User, optProf
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
commit, err := profileGitRepo.GetBranchCommit(profileDbRepo.DefaultBranch)
|
||||
commit, err := profileGitRepo.GetBranchCommit(ctx, profileDbRepo.DefaultBranch)
|
||||
if err != nil {
|
||||
log.Error("FindOwnerProfileReadme failed to GetBranchCommit: %v", err)
|
||||
return nil, nil
|
||||
|
||||
@@ -251,7 +251,7 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
|
||||
total = count
|
||||
case "overview":
|
||||
if bytes, err := profileReadme.GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil {
|
||||
if bytes, err := profileReadme.GetBlobContent(ctx, setting.UI.MaxDisplayFileSize); err != nil {
|
||||
log.Error("failed to GetBlobContent: %v", err)
|
||||
} else {
|
||||
rctx := renderhelper.NewRenderContextRepoFile(ctx, profileDbRepo, renderhelper.RepoFileOptions{
|
||||
|
||||
Reference in New Issue
Block a user