mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894)
* repare and improve GetDiffRangeWithWhitespaceBehavior * Context with Timeout
This commit is contained in:
parent
f2b4b0f491
commit
bb4cc876b1
5 changed files with 26 additions and 37 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue