Browse Source

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>
next
David Pursehouse 5 years ago committed by Matthias Sohn
parent
commit
a6bdcace30
  1. 6
      org.eclipse.jgit/.settings/.api_filters
  2. 43
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

6
org.eclipse.jgit/.settings/.api_filters

@ -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">

43
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java

@ -1127,9 +1127,8 @@ public class ReceivePack {
* @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 @@ public class ReceivePack {
*
* @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 @@ public class ReceivePack {
*
* @return true if an error occurred that should be advertised.
*/
protected boolean hasError() {
private boolean hasError() {
return advertiseError != null;
}
@ -1168,7 +1167,7 @@ public class ReceivePack {
* 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 @@ public class ReceivePack {
*
* @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 @@ public class ReceivePack {
* @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 @@ public class ReceivePack {
* @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 class ReceivePack {
*
* @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 @@ public class ReceivePack {
/**
* 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 @@ public class ReceivePack {
* 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 @@ public class ReceivePack {
*
* @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 @@ public class ReceivePack {
/**
* 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 @@ public class ReceivePack {
* 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 @@ public class ReceivePack {
/**
* 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 @@ public class ReceivePack {
* @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 @@ public class ReceivePack {
* 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 @@ public class ReceivePack {
*
* @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 @@ public class ReceivePack {
* @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;

Loading…
Cancel
Save