]> source.dussan.org Git - jgit.git/commitdiff
PullCommandTest: assert git status in some simple tests 09/1203909/2
authorMatthias Sohn <matthias.sohn@sap.com>
Thu, 14 Nov 2024 22:28:17 +0000 (23:28 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 14 Nov 2024 22:30:25 +0000 (23:30 +0100)
Bug: jgit-107
Change-Id: I54856849df7c6959ccc2b6f10de510950d3da401

org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java

index 12300b339024a9bef2f73f02eabbaf108a15eb9e..6d5e45c98f5c8cdbf6e8b48e3341e2cca7e40e3f 100644 (file)
@@ -21,6 +21,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.Map;
 import java.util.concurrent.Callable;
 
 import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
@@ -29,6 +30,7 @@ import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.junit.JGitTestUtil;
 import org.eclipse.jgit.junit.RepositoryTestCase;
 import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.IndexDiff.StageState;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.lib.Repository;
@@ -117,6 +119,7 @@ public class PullCommandTest extends RepositoryTestCase {
                                        + db.getWorkTree().getAbsolutePath();
                        assertEquals(message, mergeCommit.getShortMessage());
                }
+               assertTrue(target.status().call().isClean());
        }
 
        @Test
@@ -153,6 +156,10 @@ public class PullCommandTest extends RepositoryTestCase {
                assertFileContentsEqual(targetFile, result);
                assertEquals(RepositoryState.MERGING, target.getRepository()
                                .getRepositoryState());
+               Status status = target.status().call();
+               Map<String, StageState> conflicting = status.getConflictingStageState();
+               assertEquals(1, conflicting.size());
+               assertEquals(StageState.BOTH_MODIFIED, conflicting.get("SomeFile.txt"));
        }
 
        @Test