aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java8
2 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
index 644b9017ce..0647167eab 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
+++ b/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)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java
index dbdf93b964..e450345b56 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificate.java
+++ b/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())