diff options
author | vnkmpf <tz@zztt.eu> | 2021-02-13 05:35:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-13 05:35:43 +0100 |
commit | 487f2ee41cb06f0173b8bf12bd6a78408c75fabf (patch) | |
tree | ac62859884ed23f05d6e15bbc25bea6f0b374554 /routers/repo/pull.go | |
parent | a3cc842e15eb5ed42c3125410d9c774314a286a5 (diff) | |
download | gitea-487f2ee41cb06f0173b8bf12bd6a78408c75fabf.tar.gz gitea-487f2ee41cb06f0173b8bf12bd6a78408c75fabf.zip |
Whitespace in commits (#14650)
* Add whitespace to commit view
* Add whitespace to /compare/a...b
* Move repeated whitespaceFlags to gitdiff
* Add whitespace for wiki pages
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r-- | routers/repo/pull.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 6986002102..d3dd9e4fb5 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -581,12 +581,6 @@ func ViewPullFiles(ctx *context.Context) { } pull := issue.PullRequest - whitespaceFlags := map[string]string{ - "ignore-all": "-w", - "ignore-change": "-b", - "ignore-eol": "--ignore-space-at-eol", - "": ""} - var ( diffRepoPath string startCommitID string @@ -629,7 +623,7 @@ func ViewPullFiles(ctx *context.Context) { diff, err := gitdiff.GetDiffRangeWithWhitespaceBehavior(diffRepoPath, startCommitID, endCommitID, setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, - whitespaceFlags[ctx.Data["WhitespaceBehavior"].(string)]) + gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string))) if err != nil { ctx.ServerError("GetDiffRangeWithWhitespaceBehavior", err) return @@ -993,7 +987,8 @@ func CompareAndPullRequestPost(ctx *context.Context) { // This stage is already stop creating new pull request, so it does not matter if it has // something to compare or not. - PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch) + PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch, + gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string))) if ctx.Written() { return } @@ -1003,7 +998,8 @@ func CompareAndPullRequestPost(ctx *context.Context) { } if util.IsEmptyString(form.Title) { - PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch) + PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch, + gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string))) if ctx.Written() { return } |