ReceivePack: Reduce visibility of methods

Several methods were protected when they were defined in BaseReceivePack
which has since been squashed into ReceivePack. Those methods no longer
need to be protected, and can now be private instead.

Change-Id: Ic6bb5e66f353fcbdc7919847423234af398c88b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
David Pursehouse 2019-11-13 16:40:14 -08:00 committed by Matthias Sohn
parent 830e7bf678
commit a6bdcace30
2 changed files with 26 additions and 23 deletions

View File

@ -88,6 +88,12 @@
<message_argument value="org.eclipse.jgit.transport.ReceivePack"/>
</message_arguments>
</filter>
<filter id="421572723">
<message_arguments>
<message_argument value="org.eclipse.jgit.transport.ReceivePack"/>
<message_argument value="enableCapabilities()"/>
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/jgit/util/QuotedString.java" type="org.eclipse.jgit.util.QuotedString">
<filter id="336658481">

View File

@ -1127,9 +1127,8 @@ public long getPackSize() {
* @return if the client is a shallow repository, the list of edge commits
* that define the client's shallow boundary. Empty set if the
* client is earlier than Git 1.9, or is a full clone.
* @since 3.5
*/
protected Set<ObjectId> getClientShallowCommits() {
private Set<ObjectId> getClientShallowCommits() {
return clientShallowCommits;
}
@ -1138,7 +1137,7 @@ protected Set<ObjectId> getClientShallowCommits() {
*
* @return {@code true} if any commands to be executed have been read.
*/
protected boolean hasCommands() {
private boolean hasCommands() {
return !commands.isEmpty();
}
@ -1147,7 +1146,7 @@ protected boolean hasCommands() {
*
* @return true if an error occurred that should be advertised.
*/
protected boolean hasError() {
private boolean hasError() {
return advertiseError != null;
}
@ -1168,7 +1167,7 @@ protected boolean hasError() {
* standard error channel of the command execution. For most
* other network connections this should be null.
*/
protected void init(final InputStream input, final OutputStream output,
private void init(final InputStream input, final OutputStream output,
final OutputStream messages) {
origOut = output;
rawIn = input;
@ -1199,7 +1198,7 @@ protected void init(final InputStream input, final OutputStream output,
*
* @return advertised refs, or the default if not explicitly advertised.
*/
protected Map<String, Ref> getAdvertisedOrDefaultRefs() {
private Map<String, Ref> getAdvertisedOrDefaultRefs() {
if (refs == null)
setAdvertisedRefs(null, null);
return refs;
@ -1211,7 +1210,7 @@ protected Map<String, Ref> getAdvertisedOrDefaultRefs() {
* @throws java.io.IOException
* an error occurred during unpacking or connectivity checking.
*/
protected void receivePackAndCheckConnectivity() throws IOException {
private void receivePackAndCheckConnectivity() throws IOException {
receivePack();
if (needCheckConnectivity()) {
checkSubmodules();
@ -1226,7 +1225,7 @@ protected void receivePackAndCheckConnectivity() throws IOException {
* @throws java.io.IOException
* the pack could not be unlocked.
*/
protected void unlockPack() throws IOException {
private void unlockPack() throws IOException {
if (packLock != null) {
packLock.unlock();
packLock = null;
@ -1303,7 +1302,7 @@ public ReceivedPackStatistics getReceivedPackStatistics() {
*
* @throws java.io.IOException
*/
protected void recvCommands() throws IOException {
private void recvCommands() throws IOException {
PacketLineIn pck = maxCommandBytes > 0
? new PacketLineIn(rawIn, maxCommandBytes)
: pckIn;
@ -1419,7 +1418,7 @@ void readPostCommands(PacketLineIn in) throws IOException {
/**
* Enable capabilities based on a previously read capabilities line.
*/
protected void enableCapabilities() {
private void enableCapabilities() {
reportStatus = isCapabilityEnabled(CAPABILITY_REPORT_STATUS);
usePushOptions = isCapabilityEnabled(CAPABILITY_PUSH_OPTIONS);
sideBand = isCapabilityEnabled(CAPABILITY_SIDE_BAND_64K);
@ -1443,11 +1442,11 @@ protected void enableCapabilities() {
* protocol name identifying the capability.
* @return true if the peer requested the capability to be enabled.
*/
protected boolean isCapabilityEnabled(String name) {
private boolean isCapabilityEnabled(String name) {
return enabledCapabilities.contains(name);
}
void checkRequestWasRead() {
private void checkRequestWasRead() {
if (enabledCapabilities == null)
throw new RequestNotYetReadException();
}
@ -1457,7 +1456,7 @@ void checkRequestWasRead() {
*
* @return {@code true} if a pack is expected based on the list of commands.
*/
protected boolean needPack() {
private boolean needPack() {
for (ReceiveCommand cmd : commands) {
if (cmd.getType() != ReceiveCommand.Type.DELETE)
return true;
@ -1631,7 +1630,7 @@ private void checkConnectivity() throws IOException {
/**
* Validate the command list.
*/
protected void validateCommands() {
private void validateCommands() {
for (ReceiveCommand cmd : commands) {
final Ref ref = cmd.getRef();
if (cmd.getResult() != Result.NOT_ATTEMPTED)
@ -1774,9 +1773,8 @@ protected void validateCommands() {
* Whether any commands have been rejected so far.
*
* @return if any commands have been rejected so far.
* @since 3.6
*/
protected boolean anyRejects() {
private boolean anyRejects() {
for (ReceiveCommand cmd : commands) {
if (cmd.getResult() != Result.NOT_ATTEMPTED
&& cmd.getResult() != Result.OK)
@ -1788,9 +1786,8 @@ protected boolean anyRejects() {
/**
* Set the result to fail for any command that was not processed yet.
*
* @since 3.6
*/
protected void failPendingCommands() {
private void failPendingCommands() {
ReceiveCommand.abort(commands);
}
@ -1802,14 +1799,14 @@ protected void failPendingCommands() {
* @return a copy of the command list containing only those commands with
* the desired status.
*/
protected List<ReceiveCommand> filterCommands(Result want) {
private List<ReceiveCommand> filterCommands(Result want) {
return ReceiveCommand.filter(commands, want);
}
/**
* Execute commands to update references.
*/
protected void executeCommands() {
private void executeCommands() {
List<ReceiveCommand> toApply = filterCommands(Result.NOT_ATTEMPTED);
if (toApply.isEmpty())
return;
@ -1852,7 +1849,7 @@ protected void executeCommands() {
* an error occurred writing the status report.
* @since 5.6
*/
protected void sendStatusReport(final boolean forClient,
private void sendStatusReport(final boolean forClient,
final Throwable unpackError, final Reporter out)
throws IOException {
if (unpackError != null) {
@ -1941,7 +1938,7 @@ else if (cmd.getMessage()
*
* @throws java.io.IOException
*/
protected void close() throws IOException {
private void close() throws IOException {
if (sideBand) {
// If we are using side band, we need to send a final
// flush-pkt to tell the remote peer the side band is
@ -1974,7 +1971,7 @@ protected void close() throws IOException {
* @throws java.io.IOException
* the pack could not be unlocked.
*/
protected void release() throws IOException {
private void release() throws IOException {
walk.close();
unlockPack();
timeoutIn = null;