import static java.util.Objects.requireNonNull;
+import java.util.List;
import java.util.Set;
import org.eclipse.jgit.annotations.NonNull;
final Set<String> clientCapabilities;
+ final int deepenSince;
+
+ final List<String> deepenNotRefs;
+
/**
* Initialize the common fields of a fetch request.
*
* to exclude blobs on certain conditions
* @param clientCapabilities
* capabilities sent in the request
+ * @param deepenNotRefs
+ * Requests that the shallow clone/fetch should be cut at these
+ * specific revisions instead of a depth.
+ * @param deepenSince
+ * Requests that the shallow clone/fetch should be cut at a
+ * specific time, instead of depth
*/
FetchRequest(@NonNull Set<ObjectId> wantIds, int depth,
@NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit,
- @NonNull Set<String> clientCapabilities) {
+ @NonNull Set<String> clientCapabilities, int deepenSince,
+ @NonNull List<String> deepenNotRefs) {
this.wantIds = requireNonNull(wantIds);
this.depth = depth;
this.clientShallowCommits = requireNonNull(clientShallowCommits);
this.filterBlobLimit = filterBlobLimit;
this.clientCapabilities = requireNonNull(clientCapabilities);
+ this.deepenSince = deepenSince;
+ this.deepenNotRefs = requireNonNull(deepenNotRefs);
}
/**
Set<String> getClientCapabilities() {
return clientCapabilities;
}
+
+ /**
+ * The value in a "deepen-since" line in the request, indicating the
+ * timestamp where to stop fetching/cloning.
+ *
+ * @return timestamp in seconds since the epoch, where to stop the shallow
+ * fetch/clone. Defaults to 0 if not set in the request.
+ */
+ int getDeepenSince() {
+ return deepenSince;
+ }
+
+ /**
+ * @return refs received in "deepen-not" lines.
+ */
+ @NonNull
+ List<String> getDeepenNotRefs() {
+ return deepenNotRefs;
+ }
}
\ No newline at end of file
package org.eclipse.jgit.transport;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit,
@NonNull Set<String> clientCapabilities) {
super(wantIds, depth, clientShallowCommits, filterBlobLimit,
- clientCapabilities);
+ clientCapabilities, 0, Collections.emptyList());
}
static final class Builder {
private final TreeMap<String, ObjectId> wantedRefs;
- private final int deepenSince;
-
- private final List<String> deepenNotRefs;
-
private final boolean doneReceived;
FetchV2Request(@NonNull List<ObjectId> peerHas,
@NonNull List<String> deepenNotRefs, int depth,
long filterBlobLimit,
boolean doneReceived, @NonNull Set<String> clientCapabilities) {
- super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities);
+ super(wantIds, depth, clientShallowCommits, filterBlobLimit,
+ clientCapabilities, deepenSince, deepenNotRefs);
this.peerHas = requireNonNull(peerHas);
this.wantedRefs = requireNonNull(wantedRefs);
- this.deepenSince = deepenSince;
- this.deepenNotRefs = requireNonNull(deepenNotRefs);
this.doneReceived = doneReceived;
}
return wantedRefs;
}
- /**
- * The value in a "deepen-since" line in the request, indicating the
- * timestamp where to stop fetching/cloning.
- *
- * @return timestamp in seconds since the epoch, where to stop the shallow
- * fetch/clone. Defaults to 0 if not set in the request.
- */
- int getDeepenSince() {
- return deepenSince;
- }
-
- /**
- * @return refs received in "deepen-not" lines.
- */
- @NonNull
- List<String> getDeepenNotRefs() {
- return deepenNotRefs;
- }
-
/**
* @return true if the request had a "done" line
*/
return new Builder();
}
-
/** A builder for {@link FetchV2Request}. */
static final class Builder {
final List<ObjectId> peerHas = new ArrayList<>();