Skip to content

Commit

Permalink
Upgrade jgit to 6.9.0.202403050737-r
Browse files Browse the repository at this point in the history
  • Loading branch information
wetneb committed Apr 6, 2024
1 parent 29f187f commit c86a2e2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -74,7 +74,7 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>6.3.0.202209071007-r</version>
<version>6.9.0.202403050737-r</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/se/kth/spork/util/LineBasedMerge.kt
Expand Up @@ -63,6 +63,9 @@ fun lineBasedMerge(base: String, left: String, right: String): Pair<String, Int>
inConflict = true
}
lines.add(SporkPrettyPrinter.MID_CONFLICT)
} else if (chunk.conflictState
== MergeChunk.ConflictState.BASE_CONFLICTING_RANGE) {
continue;
}
for (i in chunk.begin until chunk.end) {
lines.add(seq.getString(i))
Expand Down
27 changes: 27 additions & 0 deletions src/test/java/se/kth/spork/LineBasedMergeTest.java
@@ -0,0 +1,27 @@
package se.kth.spork;

import kotlin.Pair;
import org.junit.jupiter.api.Test;
import se.kth.spork.util.LineBasedMergeKt;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class LineBasedMergeTest {

@Test
public void testMergeWithDeletionsMinimal() {
Pair<String, Integer> result = LineBasedMergeKt.lineBasedMerge(
"a\nB\nC\nD\ne",
"a\nB\nC\ne",
"a\nB\nD\ne");

assertEquals("a\n" +
"B\n" +
"<<<<<<< LEFT\n" +
"C\n" +
"=======\n" +
"D\n" +
">>>>>>> RIGHT\n" +
"e", result.component1());
}
}

0 comments on commit c86a2e2

Please sign in to comment.