jgit/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff
Thomas Wolf c2204bb683 Make the buffer size for text/binary detection configurable
The various streams used in JGit for text/binary and CR-LF detection
used different buffer sizes. Most used 8000, but one used 8KiB, and one
used 8096 (SIC!) bytes.

Considering only the first 8kB of a file/blob is not sufficient; it
may give behavior incompatible with C git. C git considers the whole
blob; since it uses memory-mapped files it can do so with acceptable
performance. Doing this in JGit would most likely incur a noticeable
performance penalty. But 8kB is a bit small; in the file in bug 576971
the limit was hit before the first CR-LF, which occurred on line 155
at offset 9759 in the file.

Make RawText.FIRST_FEW_BYTES only a default and minimum setting, and
set it to 8KiB. Make the actual buffer size configurable: provide
static methods getBufferSize() and setBuffersize(), and use
getBufferSize() throughout instead of the constant.

This enables users of the JGit library to set their own possibly larger
buffer size.

Bug: 576971
Change-Id: I447762c9a5147a521f73d2864ba59ed89f555d54
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2021-10-30 23:05:22 +02:00
..
AbstractDiffTestCase.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
DiffEntryTest.java Replace deprecated junit assertion methods with hamcrest 2020-01-22 18:16:17 +01:00
DiffFormatterReflowTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
DiffFormatterTest.java Make the buffer size for text/binary detection configurable 2021-10-30 23:05:22 +02:00
EditListTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
EditTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
HistogramDiffTest.java Remove redundant type arguments 2021-09-30 09:31:12 +02:00
MyersDiffTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
PatchIdDiffFormatterTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RawTextIgnoreAllWhitespaceTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RawTextIgnoreLeadingWhitespaceTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RawTextIgnoreTrailingWhitespaceTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RawTextIgnoreWhitespaceChangeTest.java Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash() 2020-06-02 00:13:37 +02:00
RawTextLoadTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RawTextTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00
RenameDetectorTest.java Skip detecting content renames for binary files 2021-05-31 13:48:37 +02:00
SimilarityIndexTest.java Update EDL 1.0 license headers to new short SPDX compliant format 2020-01-04 01:10:05 +01:00