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 <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
This commit is contained in:
parent
4e8feb96a3
commit
346bc34169
|
@ -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 @@ Set<ObjectId> getClientShallowCommits() {
|
|||
* @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 @@ static final class Builder {
|
|||
|
||||
int depth;
|
||||
|
||||
int shallowSince;
|
||||
int deepenSince;
|
||||
|
||||
long filterBlobLimit = -1;
|
||||
|
||||
|
@ -309,11 +309,11 @@ Builder addDeepenNotRef(String deepenNotRef) {
|
|||
|
||||
/**
|
||||
* @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 @@ Builder setShallowSince(int value) {
|
|||
* @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 @@ Builder setDoneReceived() {
|
|||
*/
|
||||
FetchV2Request build() {
|
||||
return new FetchV2Request(peerHas, wantedRefs, wantsIds,
|
||||
clientShallowCommits, shallowSince, deepenNotRefs,
|
||||
clientShallowCommits, deepenSince, deepenNotRefs,
|
||||
depth, filterBlobLimit, doneReceived, options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1016,7 +1016,7 @@ private void fetchV2() throws IOException {
|
|||
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 @@ private void fetchV2() throws IOException {
|
|||
} 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 @@ private void fetchV2() throws IOException {
|
|||
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 @@ private void fetchV2() throws IOException {
|
|||
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 @@ private void fetchV2() throws IOException {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue