Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
index ed7465c82a..57d6bc2466 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
@@ -245,8 +245,12 @@ public abstract class BasePackFetchConnection extends BasePackConnection
private PacketLineOut pckState;
- /** If not -1, the maximum blob size to be sent to the server. */
- private final long filterBlobLimit;
+ /**
+ * Either FilterSpec.NO_FILTER for a filter that doesn't filter
+ * anything, or a filter that indicates what and what not to send to the
+ * server.
+ */
+ private final FilterSpec filterSpec;
/**
* Create a new connection to fetch using the native git transport.
@@ -268,10 +272,11 @@ public abstract class BasePackFetchConnection extends BasePackConnection
includeTags = transport.getTagOpt() != TagOpt.NO_TAGS;
thinPack = transport.isFetchThin();
- filterBlobLimit = transport.getFilterBlobLimit();
+ filterSpec = transport.getFilterSpec();
if (local != null) {
walk = new RevWalk(local);
+ walk.setRetainBody(false);
reachableCommits = new RevCommitList<>();
REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$
COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$
@@ -395,10 +400,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
} catch (CancelledException ce) {
close();
return; // Caller should test (or just know) this themselves.
- } catch (IOException err) {
- close();
- throw new TransportException(err.getMessage(), err);
- } catch (RuntimeException err) {
+ } catch (IOException | RuntimeException err) {
close();
throw new TransportException(err.getMessage(), err);
}
@@ -520,10 +522,8 @@ public abstract class BasePackFetchConnection extends BasePackConnection
if (first) {
return false;
}
- if (filterBlobLimit == 0) {
- p.writeString(OPTION_FILTER + " blob:none"); //$NON-NLS-1$
- } else if (filterBlobLimit > 0) {
- p.writeString(OPTION_FILTER + " blob:limit=" + filterBlobLimit); //$NON-NLS-1$
+ if (!filterSpec.isNoOp()) {
+ p.writeString(filterSpec.filterLine());
}
p.end();
outNeedsEnd = false;
@@ -565,7 +565,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
OPTION_MULTI_ACK_DETAILED));
}
- if (filterBlobLimit >= 0 && !wantCapability(line, OPTION_FILTER)) {
+ if (!filterSpec.isNoOp() && !wantCapability(line, OPTION_FILTER)) {
throw new PackProtocolException(uri,
JGitText.get().filterRequiresCapability);
}
@@ -670,14 +670,14 @@ public abstract class BasePackFetchConnection extends BasePackConnection
}
}
- if (noDone & receivedReady) {
+ if (noDone && receivedReady) {
break SEND_HAVES;
}
if (statelessRPC) {
state.writeTo(out, null);
}
- if (receivedContinue && havesSinceLastContinue > MAX_HAVES
+ if ((receivedContinue && havesSinceLastContinue > MAX_HAVES)
|| havesSent >= maxHaves) {
// Our history must be really different from the remote's.
// We just sent a whole slew of have lines, and it did not

Back to the top