]> source.dussan.org Git - jgit.git/commit
Treat RawText of binary data as file with one single line. 76/102076/3
authorHan-Wen Nienhuys <hanwen@google.com>
Thu, 27 Jul 2017 11:58:49 +0000 (13:58 +0200)
committerHan-Wen Nienhuys <hanwen@google.com>
Tue, 1 Aug 2017 14:00:46 +0000 (16:00 +0200)
commita551b64694c24fff58014ae5ca298b47539cf96d
tree2a2056ce64761130bfe78e281c427180f74163f0
parentab0eedcead5b38e446e7a022de1c749c5e37f115
Treat RawText of binary data as file with one single line.

This avoids executing mergeAlgorithm.merge on binary data, which is
unlikely to be useful.

Arguably, binary data should not make it to
ResolveMerger#contentMerge, but this approach has the following
advantages:

* binary detection is exact, since it doesn't only look at the start
  of the blob.

* it is cheap, as we have to iterate over the bytes anyway to find
  '\n'.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I424295df1dc60a719859d9d7c599067891b15792
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_LineMapTest.java
org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java