]> source.dussan.org Git - jgit.git/commitdiff
Make RepositoryState.REBASING_MERGE reachable again. 32/36832/4
authorLaurent Delaigue <laurent.delaigue@obeo.fr>
Fri, 21 Nov 2014 10:28:19 +0000 (11:28 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 27 Mar 2015 14:58:05 +0000 (15:58 +0100)
If a non interactive rebase is launched, stopping after a conflict
should set the repository state to RepositoryState.REBASING_MERGE
instead of RepositoryState.REBASING_INTERACTIVE.

Bug: 452623
Change-Id: Ie885aab6d71dabd158a718af0d14fff643c9b850
Also-by: Arthur Daussy <arthur.daussy@obeo.fr>
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

index 25534fdda6a5e5219d2604fa91c5d0f7aa80002d..9ad845b2a9bd99e355f6256d7fcf842842f4bb8e 100644 (file)
@@ -180,7 +180,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase {
                                + remoteUri
                                + "\nSource change\n=======\nTarget change\n>>>>>>> 42453fd Target change in local\n";
                assertFileContentsEqual(targetFile, result);
-               assertEquals(RepositoryState.REBASING_INTERACTIVE, target
+               assertEquals(RepositoryState.REBASING_MERGE, target
                                .getRepository().getRepositoryState());
        }
 
@@ -225,7 +225,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase {
                String result = "<<<<<<< Upstream, based on branch 'master' of local repository\n"
                                + "Master change\n=======\nSlave change\n>>>>>>> 4049c9e Source change in based on master\n";
                assertFileContentsEqual(targetFile, result);
-               assertEquals(RepositoryState.REBASING_INTERACTIVE, target
+               assertEquals(RepositoryState.REBASING_MERGE, target
                                .getRepository().getRepositoryState());
        }
 
index 8e64776f72436e4f46a33fff5414c92ac42d0867..6b641c495f7aeaa486c2166125ca585a83b4ee4b 100644 (file)
@@ -824,7 +824,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
                                "<<<<<<< Upstream, based on master\n1master\n=======\n1topic",
                                ">>>>>>> e0d1dea change file1 in topic\n2\n3\ntopic4");
 
-               assertEquals(RepositoryState.REBASING_INTERACTIVE, db
+               assertEquals(RepositoryState.REBASING_MERGE, db
                                .getRepositoryState());
                assertTrue(new File(db.getDirectory(), "rebase-merge").exists());
                // the first one should be included, so we should have left two picks in
@@ -887,7 +887,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
                                "<<<<<<< Upstream, based on master\n1master\n=======\n1topic",
                                ">>>>>>> e0d1dea change file1 in topic\n2\n3\ntopic4");
 
-               assertEquals(RepositoryState.REBASING_INTERACTIVE,
+               assertEquals(RepositoryState.REBASING_MERGE,
                                db.getRepositoryState());
                assertTrue(new File(db.getDirectory(), "rebase-merge").exists());
                // the first one should be included, so we should have left two picks in
@@ -1009,7 +1009,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
                res = git.rebase().setOperation(Operation.CONTINUE).call();
                assertNotNull(res);
                assertEquals(Status.NOTHING_TO_COMMIT, res.getStatus());
-               assertEquals(RepositoryState.REBASING_INTERACTIVE,
+               assertEquals(RepositoryState.REBASING_MERGE,
                                db.getRepositoryState());
 
                git.rebase().setOperation(Operation.SKIP).call();
@@ -1300,7 +1300,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
                // user can decide what to do. if he accidentally committed, reset soft,
                // and continue, if he really has nothing to commit, skip.
                assertEquals(Status.NOTHING_TO_COMMIT, res.getStatus());
-               assertEquals(RepositoryState.REBASING_INTERACTIVE,
+               assertEquals(RepositoryState.REBASING_MERGE,
                                db.getRepositoryState());
 
                git.rebase().setOperation(Operation.SKIP).call();
@@ -1401,7 +1401,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
                assertEquals(Status.STOPPED, res.getStatus());
                assertEquals(conflicting, res.getCurrentCommit());
 
-               assertEquals(RepositoryState.REBASING_INTERACTIVE, db
+               assertEquals(RepositoryState.REBASING_MERGE, db
                                .getRepositoryState());
                assertTrue(new File(db.getDirectory(), "rebase-merge").exists());
                // the first one should be included, so we should have left two picks in
index 7d3e82318707cc131b180752fa152fc3bed52a26..62001d0a78e546a3fc230d681c4d190b664ff37c 100644 (file)
@@ -1088,7 +1088,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
                rebaseState.createFile(HEAD_NAME, headName);
                rebaseState.createFile(ONTO, upstreamCommit.name());
                rebaseState.createFile(ONTO_NAME, upstreamCommitName);
-               rebaseState.createFile(INTERACTIVE, ""); //$NON-NLS-1$
+               if (isInteractive()) {
+                       rebaseState.createFile(INTERACTIVE, ""); //$NON-NLS-1$
+               }
                rebaseState.createFile(QUIET, ""); //$NON-NLS-1$
 
                ArrayList<RebaseTodoLine> toDoSteps = new ArrayList<RebaseTodoLine>();