diff options
author | zeripath <art27@cantab.net> | 2021-11-21 16:51:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-22 00:51:08 +0800 |
commit | 8511eec4d447499e37c1c3fbe3b1f9353ce36190 (patch) | |
tree | 2320539c50d2813906d0635b9dbe4b2ba19aadd8 /services/gitdiff/gitdiff_test.go | |
parent | d710af6669654f27f02b69d7ef1ba563e7d58a90 (diff) | |
download | gitea-8511eec4d447499e37c1c3fbe3b1f9353ce36190.tar.gz gitea-8511eec4d447499e37c1c3fbe3b1f9353ce36190.zip |
Allow Loading of Diffs that are too large (#17739)
* Allow Loading of Diffs that are too large
This PR allows the loading of diffs that are suppressed because the file
is too large. It does not handle diffs of files which have lines which
are too long.
Fix #17738
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services/gitdiff/gitdiff_test.go')
-rw-r--r-- | services/gitdiff/gitdiff_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go index 76a8b4e7ca..7d63beffeb 100644 --- a/services/gitdiff/gitdiff_test.go +++ b/services/gitdiff/gitdiff_test.go @@ -693,8 +693,15 @@ func TestGetDiffRangeWithWhitespaceBehavior(t *testing.T) { } defer gitRepo.Close() for _, behavior := range []string{"-w", "--ignore-space-at-eol", "-b", ""} { - diffs, err := GetDiffRangeWithWhitespaceBehavior(gitRepo, "559c156f8e0178b71cb44355428f24001b08fc68", "bd7063cc7c04689c4d082183d32a604ed27a24f9", "", - setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffFiles, behavior, false) + diffs, err := GetDiff(gitRepo, + &DiffOptions{ + AfterCommitID: "bd7063cc7c04689c4d082183d32a604ed27a24f9", + BeforeCommitID: "559c156f8e0178b71cb44355428f24001b08fc68", + MaxLines: setting.Git.MaxGitDiffLines, + MaxLineCharacters: setting.Git.MaxGitDiffLineCharacters, + MaxFiles: setting.Git.MaxGitDiffFiles, + WhitespaceBehavior: behavior, + }) assert.NoError(t, err, fmt.Sprintf("Error when diff with %s", behavior)) for _, f := range diffs.Files { assert.True(t, len(f.Sections) > 0, fmt.Sprintf("%s should have sections", f.Name)) |