Skip to content

Commit

Permalink
Upgrade jgit to 6.9.0.202403050737-r
Browse files Browse the repository at this point in the history
Fixes #487.
  • Loading branch information
wetneb committed Apr 6, 2024
1 parent 29f187f commit 00ca473
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
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
4 changes: 4 additions & 0 deletions src/main/kotlin/se/kth/spork/util/LineBasedMerge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package se.kth.spork;

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

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

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 00ca473

Please sign in to comment.