summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2011-05-05 13:38:40 -0400
committerCode Review <codereview-daemon@eclipse.org>2011-05-05 13:38:40 -0400
commit18b7e9400e5282bd3c47ec2d4772e4b1cae68683 (patch)
tree9185bc86fa705153ffb8ce4b2ff4799eaaa448e7
parentde8946c0c2c63907c0b14f2d9c419ac338b60588 (diff)
parent7546e3b4c5612e5f6ee564d0d01b17533e7e0b3b (diff)
downloadjgit-18b7e9400e5282bd3c47ec2d4772e4b1cae68683.tar.gz
jgit-18b7e9400e5282bd3c47ec2d4772e4b1cae68683.zip
Merge "Fix "into" part of merge message for HEAD"
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java3
2 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java
index 04cfa25197..4ccc0f9bed 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java
@@ -169,6 +169,15 @@ public class MergeMessageFormatterTest extends SampleDataRepositoryTestCase {
}
@Test
+ public void testIntoHeadOtherThanMaster() throws IOException {
+ Ref a = db.getRef("refs/heads/a");
+ Ref b = db.getRef("refs/heads/b");
+ SymbolicRef head = new SymbolicRef("HEAD", b);
+ String message = formatter.format(Arrays.asList(a), head);
+ assertEquals("Merge branch 'a' into b", message);
+ }
+
+ @Test
public void testIntoSymbolicRefHeadPointingToMaster() throws IOException {
Ref a = db.getRef("refs/heads/a");
Ref master = db.getRef("refs/heads/master");
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
index 96395d0bfa..11f3b7a3fd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
@@ -115,8 +115,7 @@ public class MergeMessageFormatter {
String targetName = target.getLeaf().getName();
if (!targetName.equals(Constants.R_HEADS + Constants.MASTER)) {
- String targetShortName = Repository
- .shortenRefName(target.getName());
+ String targetShortName = Repository.shortenRefName(targetName);
sb.append(" into " + targetShortName);
}