From: Jonathan Nieder Date: Fri, 31 Aug 2018 20:07:45 +0000 (-0700) Subject: FetchV2Request: Rename shallowSince to deepenSince X-Git-Tag: v5.1.0.201809051400-rc1~1^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F128478%2F1;p=jgit.git FetchV2Request: Rename shallowSince to deepenSince 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 Signed-off-by: Jonathan Nieder --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java index 92e21bce22..853d96905c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java @@ -69,7 +69,7 @@ public final class FetchV2Request { private final Set clientShallowCommits; - private final int shallowSince; + private final int deepenSince; private final List deepenNotRefs; @@ -83,14 +83,14 @@ public final class FetchV2Request { private FetchV2Request(List peerHas, TreeMap wantedRefs, Set wantsIds, - Set clientShallowCommits, int shallowSince, + Set clientShallowCommits, int deepenSince, List deepenNotRefs, int depth, long filterBlobLimit, boolean doneReceived, Set 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); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 41883c98a2..b1d7e5447c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -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);