Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 980ba7663d..33c4cc9b4c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -45,6 +45,7 @@ import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
@@ -129,8 +130,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
}
}
- @Test
- public void testCheckoutWithConflictsAndReset() throws Exception {
+ private void checkoutWithConflictsAndReset(boolean stage)
+ throws Exception {
String charset = ResourcesPlugin.getWorkspace().getRoot()
.getProject(PROJ1).getDefaultCharset();
String file1Content = getTestFileContent();
@@ -140,6 +141,11 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
new ByteArrayInputStream(
"New content".getBytes(charset)),
IResource.NONE, null);
+ if (stage) {
+ try (Git git = new Git(lookupRepository(repositoryFile))) {
+ git.add().addFilepattern(FILE1_PATH).call();
+ }
+ }
String file2Content = "Also changed";
ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1)
.getFolder(FOLDER).getFile(FILE2).setContents(
@@ -163,6 +169,16 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
}
@Test
+ public void testCheckoutWithConflictsAndReset() throws Exception {
+ checkoutWithConflictsAndReset(false);
+ }
+
+ @Test
+ public void testCheckoutWithStagedConflictsAndReset() throws Exception {
+ checkoutWithConflictsAndReset(true);
+ }
+
+ @Test
public void testCheckoutWithNonDeleted() throws Exception {
// we need to check if this file system has problems to
// delete a file with an open FileInputStrem

Back to the top