Only use LF for line breaks in diffs

Git uses LF for line breaks in diffs, not CR or other delimiters. When
we are using other delimiters for diving diff output into lines, too,
we can get errors because diff lines can contain CRs. When we try to
split such lines, we get exceptions because these lines cannot be parsed
This commit is contained in:
René Pfeuffer
2020-06-15 17:03:54 +02:00
parent d502b9a864
commit bd4fc86db1
2 changed files with 2 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixes configuration of jetty listener address with system property `jetty.host` ([#1173](https://github.com/scm-manager/scm-manager/pull/1173), [#1174](https://github.com/scm-manager/scm-manager/pull/1174))
- Fixes loading plugin bundles with context path `/` ([#1182](https://github.com/scm-manager/scm-manager/pull/1182/files), [#1181](https://github.com/scm-manager/scm-manager/issues/1181))
- Sets the new plugin center URL once ([#1184](https://github.com/scm-manager/scm-manager/pull/1184))
- Diffs with CR characters are parsed correctly ([#1185](https://github.com/scm-manager/scm-manager/pull/1185))
## [2.0.0] - 2020-06-04
### Added

View File

@@ -49,7 +49,7 @@ final class GitHunkParser {
public List<Hunk> parse(String content) {
List<Hunk> hunks = new ArrayList<>();
try (Scanner scanner = new Scanner(content).useDelimiter("[\n\r\u2028\u2029\u0085]+")) {
try (Scanner scanner = new Scanner(content).useDelimiter("\n")) {
while (scanner.hasNext()) {
String line = scanner.next();
if (line.startsWith("@@")) {