Browse Source

PushCertificate: Omit null pushee from text representation

Change-Id: Ie9546f2e0e9ee62e0a3c919572153b6076355195
stable-4.1
Dave Borowitz 10 years ago
parent
commit
94812ef1e9
  1. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java

@ -360,6 +360,7 @@ public class PushCertificateParserTest {
PushCertificate cert = parser.build();
assertEquals("0.1", cert.getVersion());
assertNull(cert.getPushee());
assertFalse(cert.toText().contains(PushCertificateParser.PUSHEE));
}
private static String concatPacketLines(String input, int begin, int end)

8
org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java

@ -219,9 +219,11 @@ public class PushCertificate {
StringBuilder sb = new StringBuilder()
.append(VERSION).append(' ').append(version).append('\n')
.append(PUSHER).append(' ').append(getPusher())
.append('\n')
.append(PUSHEE).append(' ').append(pushee).append('\n')
.append(NONCE).append(' ').append(nonce).append('\n')
.append('\n');
if (pushee != null) {
sb.append(PUSHEE).append(' ').append(pushee).append('\n');
}
sb.append(NONCE).append(' ').append(nonce).append('\n')
.append('\n');
for (ReceiveCommand cmd : commands) {
sb.append(cmd.getOldId().name())

Loading…
Cancel
Save