Browse Source

Merge "Fix "into" part of merge message for HEAD"

stable-1.0
Shawn Pearce 14 years ago committed by Code Review
parent
commit
18b7e9400e
  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