Browse Source

Fix "into" part of merge message for HEAD

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>
stable-1.0
Robin Stocker 14 years ago
parent
commit
7546e3b4c5
  1. 9
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java
  2. 3
      org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java

9
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeMessageFormatterTest.java

@ -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");

3
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);
}

Loading…
Cancel
Save