From 4b4644bc73ab00c334d2c5679f28174a0acb70b3 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Sun, 10 Oct 2021 03:00:56 +0200 Subject: [PATCH] Added line jump at the end of each diff line --- src/main/kotlin/app/git/DiffManager.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/git/DiffManager.kt b/src/main/kotlin/app/git/DiffManager.kt index c9e65f3..e8c17c9 100644 --- a/src/main/kotlin/app/git/DiffManager.kt +++ b/src/main/kotlin/app/git/DiffManager.kt @@ -7,6 +7,8 @@ import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.DiffFormatter import org.eclipse.jgit.dircache.DirCacheIterator import org.eclipse.jgit.lib.Repository +import org.eclipse.jgit.revplot.PlotCommit +import org.eclipse.jgit.revplot.PlotCommitList import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevTree import org.eclipse.jgit.revwalk.RevWalk @@ -39,8 +41,15 @@ class DiffManager @Inject constructor() { // TODO This is just a workaround, try to find properly which lines have to be displayed by using a custom diff + val containsWindowsNewLine = diff.contains("\r\n") + return@withContext diff.split("\n", "\r\n").filterNot { - it.startsWith("diff --app.git") + it.startsWith("diff --git") + }.map { + if (containsWindowsNewLine) + "$it\r\n" + else + "$it\n" } }