diff options
author | 6543 <6543@obermui.de> | 2021-08-31 06:16:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 06:16:23 +0200 |
commit | bb4cc876b1d0d5be5aa3fed7827ba3eac8f2ac18 (patch) | |
tree | 06103b4f7c74a70c8280d4b71fbebb6859ff66d3 /routers/web/repo/pull.go | |
parent | f2b4b0f491014753f509eccbcd157c198dd287b3 (diff) | |
download | gitea-bb4cc876b1d0d5be5aa3fed7827ba3eac8f2ac18.tar.gz gitea-bb4cc876b1d0d5be5aa3fed7827ba3eac8f2ac18.zip |
Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894)
* repare and improve GetDiffRangeWithWhitespaceBehavior
* Context with Timeout
Diffstat (limited to 'routers/web/repo/pull.go')
-rw-r--r-- | routers/web/repo/pull.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index a41c9eb2b4..6e83a72c24 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -599,10 +599,9 @@ func ViewPullFiles(ctx *context.Context) { pull := issue.PullRequest var ( - diffRepoPath string startCommitID string endCommitID string - gitRepo *git.Repository + gitRepo = ctx.Repo.GitRepo ) var prInfo *git.CompareInfo @@ -619,9 +618,6 @@ func ViewPullFiles(ctx *context.Context) { return } - diffRepoPath = ctx.Repo.GitRepo.Path - gitRepo = ctx.Repo.GitRepo - headCommitID, err := gitRepo.GetRefCommitID(pull.GetGitRefName()) if err != nil { ctx.ServerError("GetRefCommitID", err) @@ -635,7 +631,7 @@ func ViewPullFiles(ctx *context.Context) { ctx.Data["Reponame"] = ctx.Repo.Repository.Name ctx.Data["AfterCommitID"] = endCommitID - diff, err := gitdiff.GetDiffRangeWithWhitespaceBehavior(diffRepoPath, + diff, err := gitdiff.GetDiffRangeWithWhitespaceBehavior(gitRepo, startCommitID, endCommitID, setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string))) |