summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Stocker2011-05-05 11:33:01 (EDT)
committer Robin Stocker2011-05-05 11:50:44 (EDT)
commit7546e3b4c5612e5f6ee564d0d01b17533e7e0b3b (patch)
tree8e7e81579316132cfab6364073685781143fc0cf
parenteb9dba2fde1b0581ecae1e509a981a6158285f39 (diff)
downloadjgit-7546e3b4c5612e5f6ee564d0d01b17533e7e0b3b.zip
jgit-7546e3b4c5612e5f6ee564d0d01b17533e7e0b3b.tar.gz
jgit-7546e3b4c5612e5f6ee564d0d01b17533e7e0b3b.tar.bz2
Fix "into" part of merge message for HEADrefs/changes/38/3338/2
Merging into a non-master branch would result in the following message: Merge branch 'a' into HEAD Now the merge message is correct: Merge branch 'a' into b Change-Id: I488f97190e4c1711c23a7a3cbd64f8b13a87bbac Signed-off-by: Robin Stocker <robin@nibor.org>
-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 04cfa25..4ccc0f9 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 96395d0..11f3b7a 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);
}