public class ReceivePack extends BaseReceivePack
BaseReceivePack.FirstLine, BaseReceivePack.MessageOutputWrapper, BaseReceivePack.ReceiveConfig, BaseReceivePack.Reporter
Modifier and Type | Field and Description |
---|---|
private boolean |
echoCommandFailures |
private PostReceiveHook |
postReceive
Hook to report on the commands after execution.
|
private PreReceiveHook |
preReceive
Hook to validate the update commands before execution.
|
private java.util.List<java.lang.String> |
pushOptions |
private boolean |
reportStatus
If
BasePackPushConnection.CAPABILITY_REPORT_STATUS is enabled. |
private boolean |
usePushOptions
Whether the client intends to use push options.
|
Constructor and Description |
---|
ReceivePack(Repository into)
Create a new pack receive for an open repository.
|
Modifier and Type | Method and Description |
---|---|
private void |
autoGc() |
protected void |
enableCapabilities()
Enable capabilities based on a previously read capabilities line.
|
protected java.lang.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.
|
java.util.List<java.lang.String> |
getPushOptions()
Gets an unmodifiable view of the option strings associated with the push.
|
(package private) void |
readPostCommands(PacketLineIn in) |
void |
receive(java.io.InputStream input,
java.io.OutputStream output,
java.io.OutputStream messages)
Execute the receive task on the socket.
|
private void |
service() |
void |
setEchoCommandFailures(boolean echo)
Set whether this class will report command failures as warning messages
before sending the command results.
|
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 |
setPushOptions(java.util.List<java.lang.String> options)
Set the push options supplied by the client.
|
anyRejects, checkRequestWasRead, close, executeCommands, failPendingCommands, filterCommands, getAdvertisedObjects, getAdvertisedOrDefaultRefs, getAdvertisedRefs, getAdvertiseRefsHook, getAllCommands, getClientShallowCommits, getMessageOutputStream, getPackSize, getPeerUserAgent, getPushCertificate, getReceivedPackStatistics, getRefFilter, getRefLogIdent, getRepository, getRevWalk, getTimeout, hasCommands, hasError, init, isAllowBranchDeletes, isAllowCreates, isAllowDeletes, isAllowNonFastForwards, isAllowPushOptions, isAllowQuiet, isAtomic, isBiDirectionalPipe, isCapabilityEnabled, isCheckReceivedObjects, isCheckReferencedObjectsAreReachable, isExpectDataAfterPackFooter, isQuiet, isSideBand, needPack, parseCommand, receivePackAndCheckConnectivity, recvCommands, release, sendAdvertisedRefs, sendError, sendMessage, sendStatusReport, setAdvertisedRefs, setAdvertiseRefsHook, setAllowBranchDeletes, setAllowCreates, setAllowDeletes, setAllowNonFastForwards, setAllowPushOptions, setAllowQuiet, setAtomic, setBiDirectionalPipe, setCheckReceivedObjects, setCheckReferencedObjectsAreReachable, setExpectDataAfterPackFooter, setMaxCommandBytes, setMaxCommandDiscardBytes, setMaxObjectSizeLimit, setMaxPackSizeLimit, setObjectChecker, setPushCertificate, setRefFilter, setRefLogIdent, setSignedPushConfig, setTimeout, unlockPack, validateCommands
private PreReceiveHook preReceive
private PostReceiveHook postReceive
private boolean reportStatus
BasePackPushConnection.CAPABILITY_REPORT_STATUS
is enabled.private boolean echoCommandFailures
private boolean usePushOptions
private java.util.List<java.lang.String> pushOptions
public ReceivePack(Repository into)
into
- the destination repository.@Nullable public java.util.List<java.lang.String> getPushOptions()
public void setPushOptions(@Nullable java.util.List<java.lang.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.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(java.io.InputStream input, java.io.OutputStream output, java.io.OutputStream messages) throws java.io.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.java.io.IOException
protected void enableCapabilities()
enableCapabilities
in class BaseReceivePack
void readPostCommands(PacketLineIn in) throws java.io.IOException
readPostCommands
in class BaseReceivePack
in
- request stream.java.io.IOException
- request line cannot be read.private void service() throws java.io.IOException
java.io.IOException
private void autoGc()
protected java.lang.String getLockMessageProcessName()
getLockMessageProcessName
in class BaseReceivePack