Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade jgit to 6.9.0.202403050737-r #509

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm somewhat opposed to adding new unit-ish tests unless there's strong reason for it (which I don't see, feel free to point out something I'm missing).

While this exact scenario isn't tested anywhere, line-based merge conflicts are tested in this scenario test.

If you feel something is missing, consider either adding it to the existing test scenario I linked or creating a new scenario. Or justify why this should be unit tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can remove it… for me it's a habit more than anything else, as a way to document the behaviour of individual components, but for a tool like spork I can see it makes sense to rely on integration tests instead.


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());
}
}
Loading