Browse Source

UploadPack: Use request instead of field for clientShallowCommits

Yet another member to field transition.

Change-Id: Ic801f4ac3a270b287591ef3cf722c399126ccdd4
Signed-off-by: Ivan Frade <ifrade@google.com>
stable-5.2
Ivan Frade 6 years ago
parent
commit
13b3881b3e
  1. 26
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

26
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

@ -299,9 +299,6 @@ public class UploadPack {
/** Objects on both sides, these don't have to be sent. */
private final Set<RevObject> commonBase = new HashSet<>();
/** Shallow commits the client already has. */
private Set<ObjectId> clientShallowCommits = new HashSet<>();
/** Commit time of the oldest common commit, in seconds. */
private int oldestTime;
@ -818,7 +815,6 @@ public class UploadPack {
currentRequest = req;
wantIds = req.getWantIds();
clientShallowCommits = req.getClientShallowCommits();
options = req.getClientCapabilities();
if (req.getWantIds().isEmpty()) {
@ -837,8 +833,10 @@ public class UploadPack {
else
multiAck = MultiAck.OFF;
if (!clientShallowCommits.isEmpty())
verifyClientShallow(clientShallowCommits);
if (!req.getClientShallowCommits().isEmpty()) {
verifyClientShallow(req.getClientShallowCommits());
}
if (req.getDepth() != 0 || req.getDeepenSince() != 0) {
computeShallowsAndUnshallows(req, shallow -> {
pckOut.writeString("shallow " + shallow.name() + '\n'); //$NON-NLS-1$
@ -848,8 +846,9 @@ public class UploadPack {
});
pckOut.end();
}
if (!clientShallowCommits.isEmpty())
walk.assumeShallow(clientShallowCommits);
if (!req.getClientShallowCommits().isEmpty())
walk.assumeShallow(req.getClientShallowCommits());
sendPack = negotiate(req, accumulator);
accumulator.timeNegotiating += System.currentTimeMillis()
- negotiateStart;
@ -959,7 +958,6 @@ public class UploadPack {
// copying data back to class fields
options = req.getClientCapabilities();
wantIds = req.getWantIds();
clientShallowCommits = req.getClientShallowCommits();
boolean sectionSent = false;
boolean mayHaveShallow = req.getDepth() != 0
@ -1907,8 +1905,9 @@ public class UploadPack {
pw.setUseCachedPacks(true);
}
pw.setUseBitmaps(
req.getDepth() == 0 && clientShallowCommits.isEmpty());
pw.setClientShallowCommits(clientShallowCommits);
req.getDepth() == 0
&& req.getClientShallowCommits().isEmpty());
pw.setClientShallowCommits(req.getClientShallowCommits());
pw.setReuseDeltaCommits(true);
pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA));
pw.setThin(options.contains(OPTION_THIN_PACK));
@ -1936,11 +1935,12 @@ public class UploadPack {
pw.setShallowPack(req.getDepth(), unshallowCommits);
rw = new DepthWalk.RevWalk(walk.getObjectReader(), walkDepth);
((DepthWalk.RevWalk) rw).setDeepenSince(req.getDeepenSince());
rw.assumeShallow(clientShallowCommits);
rw.assumeShallow(req.getClientShallowCommits());
}
if (wantAll.isEmpty()) {
pw.preparePack(pm, wantIds, commonBase, clientShallowCommits);
pw.preparePack(pm, wantIds, commonBase,
req.getClientShallowCommits());
} else {
walk.reset();

Loading…
Cancel
Save