aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2012-08-18 00:11:45 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2012-08-18 00:11:45 +0200
commit5854ca091a22346e1c710ca9f875165afb3f2cc8 (patch)
tree9122607332f7ac1f48bea84ce4f093317f7200a4 /org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java
parentef6aec3a04c8403037779e8122fa4c89af7d3d0b (diff)
downloadjgit-5854ca091a22346e1c710ca9f875165afb3f2cc8.tar.gz
jgit-5854ca091a22346e1c710ca9f875165afb3f2cc8.zip
Improve ours/theirs conflict markers for rebase, cherry-pick
On conflicts in rebase or cherry-pick, the conflict markers were like this: <<<<<<< OURS a ======= b >>>>>>> THEIRS This is technically correct, but it could be better. It's especially confusing during a rebase, where the meaning of OURS/THEIRS is not obvious. The intuition is that "ours" is the commits that "I" did before the rebase, but it's the other way around because of the way rebase works. See various bug reports and stackoverflow discussions. With this change, in the case of a cherry-pick while on master, the markers will be like this: <<<<<<< master a ======= b >>>>>>> bad1dea Message of the commit I'm cherry-picking In the case of a "git rebase master": <<<<<<< Upstream, based on master a ======= b >>>>>>> b161dea Message of a commit I'm rebasing It's not "master" because that would only be correct for the first cherry-pick during a rebase, after that, it's master + already cherry-picked commits. And in the case of a "git pull --rebase": <<<<<<< Upstream, based on branch 'master' of git@example.org:repo a ======= b >>>>>>> b161dea Message of a commit I'm rebasing Bug: 336819 Change-Id: I1333a8dd170bb0077f491962013485efb6f2a926 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java14
1 files changed, 12 insertions, 2 deletions
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());