summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-03-09 14:09:01 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2013-03-16 23:32:13 +0100
commit0e9f1cf57dac274f92a6db38197e14b55b3277af (patch)
treebbd8dfd7f787d4627b03d7016ce5fa7fb834a052 /org.eclipse.jgit.test
parentbba74ba2e0af10db4d75258819ca0a1b4307e377 (diff)
downloadjgit-0e9f1cf57dac274f92a6db38197e14b55b3277af.tar.gz
jgit-0e9f1cf57dac274f92a6db38197e14b55b3277af.zip
Support aborting non-interactive rebase started from C Git
Continuing is trickier, as .git/rebase-apply contains no message file and no git-rebase-todo. Bug: 336820 Change-Id: I4eb87c850078ca187b38b81cc91c92afb1176945 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
index 27f41b50ff..94577a0d68 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
+ * Copyright (C) 2010, 2013 Mathias Kinzler <mathias.kinzler@sap.com>
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -79,6 +79,7 @@ import org.eclipse.jgit.merge.MergeStrategy;
import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.util.FileUtils;
import org.junit.Before;
import org.junit.Test;
@@ -1507,6 +1508,27 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
@Test
+ public void testAbortShouldAlsoAbortNonInteractiveRebaseWithRebaseApplyDir()
+ throws Exception {
+ writeTrashFile(FILE1, "initial file");
+ git.add().addFilepattern(FILE1).call();
+ git.commit().setMessage("initial commit").call();
+
+ File applyDir = new File(db.getDirectory(), "rebase-apply");
+ File headName = new File(applyDir, "head-name");
+ FileUtils.mkdir(applyDir);
+ write(headName, "master");
+ db.writeOrigHead(db.resolve(Constants.HEAD));
+
+ git.rebase().setOperation(Operation.ABORT).call();
+
+ assertFalse("Abort should clean up .git/rebase-apply",
+ applyDir.exists());
+ assertEquals(RepositoryState.SAFE, git.getRepository()
+ .getRepositoryState());
+ }
+
+ @Test
public void testRebaseShouldBeAbleToHandleEmptyLinesInRebaseTodoFile()
throws IOException {
String emptyLine = "\n";