]> source.dussan.org Git - jgit.git/commitdiff
FetchV2Request: Rename shallowSince to deepenSince 78/128478/1
authorJonathan Nieder <jrn@google.com>
Fri, 31 Aug 2018 20:07:45 +0000 (13:07 -0700)
committerJonathan Nieder <jrn@google.com>
Fri, 31 Aug 2018 20:07:45 +0000 (13:07 -0700)
This fetch parameter is called deepen-since in the protocol.  Call it
the same thing in the request object to make the code easier to reason
about.

This doesn't touch UploadPack#shallowSince, which is likely to be
eliminated altogether in a later patch anyway.

Change-Id: I8ef34bc7ad12fae3a9057ae951367cc024e1a1cb
Suggested-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

index 92e21bce22f7829d5f8fed2bd34e0db4669d9331..853d96905c63d42dcbcdbed3e5c170bc13c714cb 100644 (file)
@@ -69,7 +69,7 @@ public final class FetchV2Request {
 
        private final Set<ObjectId> clientShallowCommits;
 
-       private final int shallowSince;
+       private final int deepenSince;
 
        private final List<String> deepenNotRefs;
 
@@ -83,14 +83,14 @@ public final class FetchV2Request {
 
        private FetchV2Request(List<ObjectId> peerHas,
                        TreeMap<String, ObjectId> wantedRefs, Set<ObjectId> wantsIds,
-                       Set<ObjectId> clientShallowCommits, int shallowSince,
+                       Set<ObjectId> clientShallowCommits, int deepenSince,
                        List<String> deepenNotRefs, int depth, long filterBlobLimit,
                        boolean doneReceived, Set<String> options) {
                this.peerHas = peerHas;
                this.wantedRefs = wantedRefs;
                this.wantsIds = wantsIds;
                this.clientShallowCommits = clientShallowCommits;
-               this.shallowSince = shallowSince;
+               this.deepenSince = deepenSince;
                this.deepenNotRefs = deepenNotRefs;
                this.depth = depth;
                this.filterBlobLimit = filterBlobLimit;
@@ -141,8 +141,8 @@ public final class FetchV2Request {
         * @return timestamp in seconds since the epoch, where to stop the shallow
         *         fetch/clone. Defaults to 0 if not set in the request.
         */
-       int getShallowSince() {
-               return shallowSince;
+       int getDeepenSince() {
+               return deepenSince;
        }
 
        /**
@@ -210,7 +210,7 @@ public final class FetchV2Request {
 
                int depth;
 
-               int shallowSince;
+               int deepenSince;
 
                long filterBlobLimit = -1;
 
@@ -309,11 +309,11 @@ public final class FetchV2Request {
 
                /**
                 * @param value
-                *            shallow since value received in a "deepen since" line
+                *            Unix timestamp received in a "deepen since" line
                 * @return the builder
                 */
-               Builder setShallowSince(int value) {
-                       this.shallowSince = value;
+               Builder setDeepenSince(int value) {
+                       this.deepenSince = value;
                        return this;
                }
 
@@ -321,8 +321,8 @@ public final class FetchV2Request {
                 * @return shallow since value, sent before in a "deepen since" line. 0
                 *         by default.
                 */
-               int getShallowSince() {
-                       return this.shallowSince;
+               int getDeepenSince() {
+                       return this.deepenSince;
                }
 
                /**
@@ -349,7 +349,7 @@ public final class FetchV2Request {
                 */
                FetchV2Request build() {
                        return new FetchV2Request(peerHas, wantedRefs, wantsIds,
-                                       clientShallowCommits, shallowSince, deepenNotRefs,
+                                       clientShallowCommits, deepenSince, deepenNotRefs,
                                        depth, filterBlobLimit, doneReceived, options);
                }
        }
index 41883c98a2bcfef968ba616dae8231e076803a8a..b1d7e5447c751e308ca120f9f54f76e12c4ab55e 100644 (file)
@@ -1016,7 +1016,7 @@ public class UploadPack {
                                                        MessageFormat.format(JGitText.get().invalidDepth,
                                                                        Integer.valueOf(parsedDepth)));
                                }
-                               if (reqBuilder.getShallowSince() != 0) {
+                               if (reqBuilder.getDeepenSince() != 0) {
                                        throw new PackProtocolException(
                                                        JGitText.get().deepenSinceWithDeepen);
                                }
@@ -1034,8 +1034,8 @@ public class UploadPack {
                        } else if (line.equals(OPTION_DEEPEN_RELATIVE)) {
                                reqBuilder.addOption(OPTION_DEEPEN_RELATIVE);
                        } else if (line.startsWith("deepen-since ")) { //$NON-NLS-1$
-                               int parsedShallowSince = Integer.parseInt(line.substring(13));
-                               if (parsedShallowSince <= 0) {
+                               int ts = Integer.parseInt(line.substring(13));
+                               if (ts <= 0) {
                                        throw new PackProtocolException(
                                                        MessageFormat.format(
                                                                        JGitText.get().invalidTimestamp, line));
@@ -1044,7 +1044,7 @@ public class UploadPack {
                                        throw new PackProtocolException(
                                                        JGitText.get().deepenSinceWithDeepen);
                                }
-                               reqBuilder.setShallowSince(parsedShallowSince);
+                               reqBuilder.setDeepenSince(ts);
                        } else if (transferConfig.isAllowFilter()
                                        && line.startsWith(OPTION_FILTER + ' ')) {
                                if (filterReceived) {
@@ -1069,7 +1069,7 @@ public class UploadPack {
                wantIds.addAll(req.getWantsIds());
                clientShallowCommits = req.getClientShallowCommits();
                depth = req.getDepth();
-               shallowSince = req.getShallowSince();
+               shallowSince = req.getDeepenSince();
                filterBlobLimit = req.getFilterBlobLimit();
                deepenNotRefs = req.getDeepenNotRefs();
 
@@ -1080,7 +1080,7 @@ public class UploadPack {
                if (!req.getClientShallowCommits().isEmpty()) {
                        verifyClientShallow(req.getClientShallowCommits());
                }
-               if (req.getDepth() != 0 || req.getShallowSince() != 0
+               if (req.getDepth() != 0 || req.getDeepenSince() != 0
                                || !req.getDeepenNotRefs().isEmpty()) {
                        shallowCommits = new ArrayList<>();
                        processShallow(shallowCommits, unshallowCommits, false);