summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java26
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java14
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java9
3 files changed, 44 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
index 469739c57c..7984d9f242 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
@@ -223,6 +223,32 @@ public class CherryPickCommandTest extends RepositoryTestCase {
assertEquals(CherryPickStatus.OK, result.getStatus());
}
+ @Test
+ public void testCherryPickConflictMarkers() throws Exception {
+ Git git = new Git(db);
+ RevCommit sideCommit = prepareCherryPick(git);
+
+ CherryPickResult result = git.cherryPick().include(sideCommit.getId())
+ .call();
+ assertEquals(CherryPickStatus.CONFLICTING, result.getStatus());
+
+ String expected = "<<<<<<< master\na(master)\n=======\na(side)\n>>>>>>> 527460a side\n";
+ checkFile(new File(db.getWorkTree(), "a"), expected);
+ }
+
+ @Test
+ public void testCherryPickOurCommitName() throws Exception {
+ Git git = new Git(db);
+ RevCommit sideCommit = prepareCherryPick(git);
+
+ CherryPickResult result = git.cherryPick().include(sideCommit.getId())
+ .setOurCommitName("custom name").call();
+ assertEquals(CherryPickStatus.CONFLICTING, result.getStatus());
+
+ String expected = "<<<<<<< custom name\na(master)\n=======\na(side)\n>>>>>>> 527460a side\n";
+ checkFile(new File(db.getWorkTree(), "a"), expected);
+ }
+
private RevCommit prepareCherryPick(final Git git) throws Exception {
// create, add and commit file a
writeTrashFile("a", "a");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
index a014071a56..1686ce1fa4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
@@ -56,6 +56,7 @@ import java.io.IOException;
import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.RebaseResult.Status;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.RepositoryState;
import org.eclipse.jgit.lib.RepositoryTestCase;
@@ -164,9 +165,17 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase {
res = target.pull().call();
+ String remoteUri = target
+ .getRepository()
+ .getConfig()
+ .getString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin",
+ ConfigConstants.CONFIG_KEY_URL);
+
assertFalse(res.getFetchResult().getTrackingRefUpdates().isEmpty());
assertTrue(res.getRebaseResult().getStatus().equals(Status.STOPPED));
- String result = "<<<<<<< OURS\nSource change\n=======\nTarget change\n>>>>>>> THEIRS\n";
+ String result = "<<<<<<< Upstream, based on branch 'master' of "
+ + remoteUri
+ + "\nSource change\n=======\nTarget change\n>>>>>>> 42453fd Target change in local\n";
assertFileContentsEqual(targetFile, result);
assertEquals(RepositoryState.REBASING_INTERACTIVE, target
.getRepository().getRepositoryState());
@@ -210,7 +219,8 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase {
assertNull(res.getFetchResult());
assertEquals(Status.STOPPED, res.getRebaseResult().getStatus());
- String result = "<<<<<<< OURS\nMaster change\n=======\nSlave change\n>>>>>>> THEIRS\n";
+ 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
.getRepository().getRepositoryState());
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 edb36b81fe..dbad322be2 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
@@ -420,7 +420,8 @@ public class RebaseCommandTest extends RepositoryTestCase {
assertEquals(Status.STOPPED, res.getStatus());
assertEquals(conflicting, res.getCurrentCommit());
checkFile(FILE1,
- "<<<<<<< OURS\n1master\n=======\n1topic\n>>>>>>> THEIRS\n2\n3\ntopic4");
+ "<<<<<<< Upstream, based on master\n1master\n=======\n1topic",
+ ">>>>>>> e0d1dea change file1 in topic\n2\n3\ntopic4");
assertEquals(RepositoryState.REBASING_INTERACTIVE, db
.getRepositoryState());
@@ -778,8 +779,10 @@ public class RebaseCommandTest extends RepositoryTestCase {
res = git.rebase().setOperation(Operation.SKIP).call();
// TODO is this correct? It is what the command line returns
- checkFile(FILE1,
- "1master\n2\n<<<<<<< OURS\n3master\n=======\n3topic\n>>>>>>> THEIRS\n4\n5topic");
+ checkFile(
+ FILE1,
+ "1master\n2\n<<<<<<< Upstream, based on master\n3master\n=======\n3topic",
+ ">>>>>>> 5afc8df change file1 in topic again\n4\n5topic");
assertEquals(Status.STOPPED, res.getStatus());
}