public class ReceivePack extends BaseReceivePack
BaseReceivePack.FirstLine, BaseReceivePack.ReceiveConfig
Constructor and Description |
---|
ReceivePack(Repository into)
Create a new pack receive for an open repository.
|
Modifier and Type | Method and Description |
---|---|
protected void |
enableCapabilities()
Enable capabilities based on a previously read capabilities line.
|
Map<String,Ref> |
getAdvertisedRefs()
Get refs which were advertised to the client.
|
protected String |
getLockMessageProcessName()
Get the process name used for pack lock messages.
|
PostReceiveHook |
getPostReceiveHook()
Get the hook invoked after updates occur.
|
PreReceiveHook |
getPreReceiveHook()
Get the hook invoked before updates occur.
|
PushCertificate |
getPushCertificate()
Get the push certificate used to verify the pusher's identity.
|
List<String> |
getPushOptions()
Gets an unmodifiable view of the option strings associated with the push.
|
Repository |
getRepository()
Get the repository this receive completes into.
|
RevWalk |
getRevWalk()
Get the RevWalk instance used by this connection.
|
void |
receive(InputStream input,
OutputStream output,
OutputStream messages)
Execute the receive task on the socket.
|
void |
setAdvertisedRefs(Map<String,Ref> allRefs,
Set<ObjectId> additionalHaves)
Set the refs advertised by this ReceivePack.
|
void |
setEchoCommandFailures(boolean echo)
Deprecated.
no widely used Git versions need this any more
|
void |
setPostReceiveHook(PostReceiveHook h)
Set the hook which is invoked after commands are executed.
|
void |
setPreReceiveHook(PreReceiveHook h)
Set the hook which is invoked prior to commands being executed.
|
void |
setPushCertificate(PushCertificate cert)
Set the push certificate used to verify the pusher's identity.
|
void |
setPushOptions(List<String> options)
Set the push options supplied by the client.
|
anyRejects, close, executeCommands, failPendingCommands, filterCommands, getAdvertisedObjects, getAdvertisedOrDefaultRefs, getAdvertiseRefsHook, getAllCommands, getClientShallowCommits, getMessageOutputStream, getPackSize, getPeerUserAgent, getReceivedPackStatistics, getRefFilter, getRefLogIdent, getTimeout, hasCommands, hasError, init, isAllowBranchDeletes, isAllowCreates, isAllowDeletes, isAllowNonFastForwards, isAllowPushOptions, isAllowQuiet, isAtomic, isBiDirectionalPipe, isCapabilityEnabled, isCheckReceivedObjects, isCheckReferencedObjectsAreReachable, isExpectDataAfterPackFooter, isQuiet, isSideBand, needPack, receivePackAndCheckConnectivity, recvCommands, release, sendAdvertisedRefs, sendError, sendMessage, sendStatusReport, setAdvertiseRefsHook, setAllowBranchDeletes, setAllowCreates, setAllowDeletes, setAllowNonFastForwards, setAllowPushOptions, setAllowQuiet, setAtomic, setBiDirectionalPipe, setCheckReceivedObjects, setCheckReferencedObjectsAreReachable, setExpectDataAfterPackFooter, setMaxCommandBytes, setMaxCommandDiscardBytes, setMaxObjectSizeLimit, setMaxPackSizeLimit, setObjectChecker, setRefFilter, setRefLogIdent, setSignedPushConfig, setTimeout, unlockPack, validateCommands
public ReceivePack(Repository into)
into
- the destination repository.public final Repository getRepository()
getRepository
in class BaseReceivePack
public final RevWalk getRevWalk()
getRevWalk
in class BaseReceivePack
public final Map<String,Ref> getAdvertisedRefs()
getAdvertisedRefs
in class BaseReceivePack
setAdvertisedRefs(Map, Set)
has not been called yet.public void setAdvertisedRefs(Map<String,Ref> allRefs, Set<ObjectId> additionalHaves)
Intended to be called from a
PreReceiveHook
.
setAdvertisedRefs
in class BaseReceivePack
allRefs
- explicit set of references to claim as advertised by this
ReceivePack instance. This overrides any references that may
exist in the source repository. The map is passed to the
configured BaseReceivePack.getRefFilter()
. If null, assumes all refs
were advertised.additionalHaves
- explicit set of additional haves to claim as advertised. If
null, assumes the default set of additional haves from the
repository.public PushCertificate getPushCertificate()
Only valid after commands are read from the wire.
getPushCertificate
in class BaseReceivePack
public void setPushCertificate(PushCertificate cert)
Should only be called if reconstructing an instance without going through
the normal BaseReceivePack.recvCommands()
flow.
setPushCertificate
in class BaseReceivePack
cert
- the push certificate to set.@Nullable public List<String> getPushOptions()
public void setPushOptions(@Nullable List<String> options)
Should only be called if reconstructing an instance without going through
the normal BaseReceivePack.recvCommands()
flow.
options
- the list of options supplied by the client. The
ReceivePack
instance takes ownership of this list.
Callers are encouraged to first create a copy if the list may
be modified later.public PreReceiveHook getPreReceiveHook()
public void setPreReceiveHook(PreReceiveHook h)
Only valid commands (those which have no obvious errors according to the
received input and this instance's configuration) are passed into the
hook. The hook may mark a command with a result of any value other than
ReceiveCommand.Result.NOT_ATTEMPTED
to
block its execution.
The hook may be called with an empty command collection if the current set is completely invalid.
h
- the hook instance; may be null to disable the hook.public PostReceiveHook getPostReceiveHook()
public void setPostReceiveHook(PostReceiveHook h)
Only successful commands (type is
ReceiveCommand.Result.OK
) are passed
into the hook. The hook may be called with an empty command collection if
the current set all resulted in an error.
h
- the hook instance; may be null to disable the hook.@Deprecated public void setEchoCommandFailures(boolean echo)
echo
- if true this class will report command failures as warning
messages before sending the command results. This is usually
not necessary, but may help buggy Git clients that discard the
errors when all branches fail.public void receive(InputStream input, OutputStream output, OutputStream messages) throws IOException
input
- raw input to read client commands and pack data from. Caller
must ensure the input is buffered, otherwise read performance
may suffer.output
- response back to the Git network client. Caller must ensure
the output is buffered, otherwise write performance may
suffer.messages
- secondary "notice" channel to send additional messages out
through. When run over SSH this should be tied back to the
standard error channel of the command execution. For most
other network connections this should be null.IOException
protected void enableCapabilities()
enableCapabilities
in class BaseReceivePack
protected String getLockMessageProcessName()
getLockMessageProcessName
in class BaseReceivePack
Copyright © 2019 Eclipse JGit Project. All rights reserved.