Move BaseReceivePack#pushCert getter and setter to ReceivePack

This is a first step toward eliminating the BaseReceivePack API.

Inspired by a larger change by Dan Wang <dwwang@google.com>.

Change-Id: I5c876a67d8db24bf808823d9ea44d991b1ce5277
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Jonathan Nieder 2018-12-26 15:59:36 -08:00 committed by Matthias Sohn
parent e78776fa5b
commit 937beaa1ae
3 changed files with 50 additions and 7 deletions

View File

@ -30,6 +30,20 @@
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/jgit/transport/BaseReceivePack.java" type="org.eclipse.jgit.transport.BaseReceivePack">
<filter id="421650549">
<message_arguments>
<message_argument value="org.eclipse.jgit.transport.BaseReceivePack"/>
<message_argument value="getPushCertificate()"/>
</message_arguments>
</filter>
<filter id="421650549">
<message_arguments>
<message_argument value="org.eclipse.jgit.transport.BaseReceivePack"/>
<message_argument value="setPushCertificate(PushCertificate)"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/jgit/transport/TransferConfig.java" type="org.eclipse.jgit.transport.TransferConfig">
<filter id="1159725059">
<message_arguments>

View File

@ -275,7 +275,7 @@ public Set<String> getCapabilities() {
private PushCertificateParser pushCertificateParser;
private SignedPushConfig signedPushConfig;
private PushCertificate pushCert;
PushCertificate pushCert;
private ReceivedPackStatistics stats;
/**
@ -286,10 +286,10 @@ public Set<String> getCapabilities() {
* @return the parsed certificate, or null if push certificates are disabled
* or no cert was presented by the client.
* @since 4.1
* @deprecated use {@link ReceivePack#getPushCertificate}.
*/
public PushCertificate getPushCertificate() {
return pushCert;
}
@Deprecated
public abstract PushCertificate getPushCertificate();
/**
* Set the push certificate used to verify the pusher's identity.
@ -300,10 +300,10 @@ public PushCertificate getPushCertificate() {
* @param cert
* the push certificate to set.
* @since 4.1
* @deprecated use {@link ReceivePack#setPushCertificate(PushCertificate)}.
*/
public void setPushCertificate(PushCertificate cert) {
pushCert = cert;
}
@Deprecated
public abstract void setPushCertificate(PushCertificate cert);
/**
* Create a new pack receive for an open repository.

View File

@ -92,6 +92,35 @@ public ReceivePack(Repository into) {
postReceive = PostReceiveHook.NULL;
}
/**
* Get the push certificate used to verify the pusher's identity.
* <p>
* Only valid after commands are read from the wire.
*
* @return the parsed certificate, or null if push certificates are disabled
* or no cert was presented by the client.
* @since 4.1
*/
@Override
public PushCertificate getPushCertificate() {
return pushCert;
}
/**
* Set the push certificate used to verify the pusher's identity.
* <p>
* Should only be called if reconstructing an instance without going through
* the normal {@link #recvCommands()} flow.
*
* @param cert
* the push certificate to set.
* @since 4.1
*/
@Override
public void setPushCertificate(PushCertificate cert) {
pushCert = cert;
}
/**
* Gets an unmodifiable view of the option strings associated with the push.
*