]> source.dussan.org Git - jgit.git/commitdiff
UploadPack: Use request instead of field for clientShallowCommits 54/129754/4
authorIvan Frade <ifrade@google.com>
Tue, 18 Sep 2018 23:06:52 +0000 (16:06 -0700)
committerIvan Frade <ifrade@google.com>
Tue, 16 Oct 2018 23:13:04 +0000 (16:13 -0700)
Yet another member to field transition.

Change-Id: Ic801f4ac3a270b287591ef3cf722c399126ccdd4
Signed-off-by: Ivan Frade <ifrade@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

index 0df350819eb0a4a2b52af5183686cc9ba1b26cf4..10df55ad48d2d83925c9a3148a0dc5d81215f9ae 100644 (file)
@@ -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();