private PackStatistics statistics;
- private long filterBlobLimit = -1;
-
/**
* Create a new pack upload for an open repository.
*
// writing a response. Buffer the response until then.
PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator();
List<ObjectId> unshallowCommits = new ArrayList<>();
+ FetchRequest req;
try {
if (biDirectionalPipe)
sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut));
accumulator.advertised = advertised.size();
ProtocolV0Parser parser = new ProtocolV0Parser(transferConfig);
- FetchV0Request req = parser.recvWants(pckIn);
+ req = parser.recvWants(pckIn);
wantIds = req.getWantIds();
clientShallowCommits = req.getClientShallowCommits();
- filterBlobLimit = req.getFilterBlobLimit();
options = req.getClientCapabilities();
depth = req.getDepth();
}
if (sendPack) {
- sendPack(accumulator, refs == null ? null : refs.values(), unshallowCommits);
+ sendPack(accumulator, req, refs == null ? null : refs.values(),
+ unshallowCommits);
}
}
clientShallowCommits = req.getClientShallowCommits();
depth = req.getDepth();
shallowSince = req.getDeepenSince();
- filterBlobLimit = req.getFilterBlobLimit();
deepenNotRefs = req.getDeepenNotRefs();
boolean sectionSent = false;
pckOut.writeDelim();
pckOut.writeString("packfile\n"); //$NON-NLS-1$
sendPack(new PackStatistics.Accumulator(),
+ req,
req.getClientCapabilities().contains(OPTION_INCLUDE_TAG)
? db.getRefDatabase().getRefsByPrefix(R_TAGS)
: null,
* Send the requested objects to the client.
*
* @param accumulator
- * where to write statistics about the content of the pack.
+ * where to write statistics about the content of the pack.
+ * @param req
+ * request in process
* @param allTags
- * refs to search for annotated tags to include in the pack
- * if the {@link #OPTION_INCLUDE_TAG} capability was
- * requested.
+ * refs to search for annotated tags to include in the pack if
+ * the {@link #OPTION_INCLUDE_TAG} capability was requested.
* @param unshallowCommits
- * shallow commits on the client that are now becoming
- * unshallow
+ * shallow commits on the client that are now becoming unshallow
* @throws IOException
- * if an error occured while generating or writing the pack.
+ * if an error occured while generating or writing the pack.
*/
private void sendPack(PackStatistics.Accumulator accumulator,
+ FetchRequest req,
@Nullable Collection<Ref> allTags,
List<ObjectId> unshallowCommits) throws IOException {
final boolean sideband = options.contains(OPTION_SIDE_BAND)
|| options.contains(OPTION_SIDE_BAND_64K);
if (sideband) {
try {
- sendPack(true, accumulator, allTags, unshallowCommits);
+ sendPack(true, req, accumulator, allTags, unshallowCommits);
} catch (ServiceMayNotContinueException noPack) {
// This was already reported on (below).
throw noPack;
throw err;
}
} else {
- sendPack(false, accumulator, allTags, unshallowCommits);
+ sendPack(false, req, accumulator, allTags, unshallowCommits);
}
}
* Send the requested objects to the client.
*
* @param sideband
- * whether to wrap the pack in side-band pkt-lines,
- * interleaved with progress messages and errors.
+ * whether to wrap the pack in side-band pkt-lines, interleaved
+ * with progress messages and errors.
+ * @param req
+ * request being processed
* @param accumulator
- * where to write statistics about the content of the pack.
+ * where to write statistics about the content of the pack.
* @param allTags
- * refs to search for annotated tags to include in the pack
- * if the {@link #OPTION_INCLUDE_TAG} capability was
- * requested.
+ * refs to search for annotated tags to include in the pack if
+ * the {@link #OPTION_INCLUDE_TAG} capability was requested.
* @param unshallowCommits
- * shallow commits on the client that are now becoming
- * unshallow
+ * shallow commits on the client that are now becoming unshallow
* @throws IOException
- * if an error occured while generating or writing the pack.
+ * if an error occured while generating or writing the pack.
*/
private void sendPack(final boolean sideband,
+ FetchRequest req,
PackStatistics.Accumulator accumulator,
@Nullable Collection<Ref> allTags,
List<ObjectId> unshallowCommits) throws IOException {
accumulator);
try {
pw.setIndexDisabled(true);
- if (filterBlobLimit >= 0) {
- pw.setFilterBlobLimit(filterBlobLimit);
+ if (req.getFilterBlobLimit() >= 0) {
+ pw.setFilterBlobLimit(req.getFilterBlobLimit());
pw.setUseCachedPacks(false);
} else {
pw.setUseCachedPacks(true);