]> source.dussan.org Git - jgit.git/commitdiff
Fix "into" part of merge message for HEAD 38/3338/2
authorRobin Stocker <robin@nibor.org>
Thu, 5 May 2011 15:33:01 +0000 (17:33 +0200)
committerRobin Stocker <robin@nibor.org>
Thu, 5 May 2011 15:50:44 +0000 (17:50 +0200)
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>
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java
org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java

index 04cfa25197c099672f8e64069d66b7e0a127e3d4..4ccc0f9bed10914da369083e277f6f38778dcdff 100644 (file)
@@ -168,6 +168,15 @@ public class MergeMessageFormatterTest extends SampleDataRepositoryTestCase {
                assertEquals("Merge branch 'a' into b", message);
        }
 
+       @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");
index 96395d0bfa6e41cbf564da730f7f81938eee0e3f..11f3b7a3fd91c2b1ef68717abcd8dba76d08d231 100644 (file)
@@ -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);
                }