/** Hook for taking post upload actions. */
private PostUploadHook postUploadHook = PostUploadHook.NULL;
- /** Capabilities requested by the client. */
- private Set<String> options;
+ /** Caller user agent */
String userAgent;
/** Raw ObjectIds the client has asked for, before validating them. */
* read.
*/
public boolean isSideBand() throws RequestNotYetReadException {
- if (options == null)
+ if (currentRequest == null) {
throw new RequestNotYetReadException();
- return (options.contains(OPTION_SIDE_BAND)
- || options.contains(OPTION_SIDE_BAND_64K));
+ }
+ Set<String> caps = currentRequest.getClientCapabilities();
+ return caps.contains(OPTION_SIDE_BAND)
+ || caps.contains(OPTION_SIDE_BAND_64K);
}
/**
currentRequest = req;
wantIds = req.getWantIds();
- options = req.getClientCapabilities();
if (req.getWantIds().isEmpty()) {
preUploadHook.onBeginNegotiateRound(this, req.getWantIds(), 0);
// TODO(ifrade): Refactor to pass around the Request object, instead of
// copying data back to class fields
- options = req.getClientCapabilities();
wantIds = req.getWantIds();
boolean sectionSent = false;
* @since 4.0
*/
public String getPeerUserAgent() {
- return UserAgent.getAgent(options, userAgent);
+ if (currentRequest == null) {
+ return userAgent;
+ }
+
+ return UserAgent.getAgent(currentRequest.getClientCapabilities(),
+ userAgent);
}
private boolean negotiate(FetchRequest req,
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);
+ Set<String> caps = req.getClientCapabilities();
+ boolean sideband = caps.contains(OPTION_SIDE_BAND)
+ || caps.contains(OPTION_SIDE_BAND_64K);
if (sideband) {
try {
sendPack(true, req, accumulator, allTags, unshallowCommits);
if (sideband) {
int bufsz = SideBandOutputStream.SMALL_BUF;
- if (options.contains(OPTION_SIDE_BAND_64K))
+ if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K))
bufsz = SideBandOutputStream.MAX_BUF;
packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA,
bufsz, rawOut);
- if (!options.contains(OPTION_NO_PROGRESS)) {
+ if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) {
msgOut = new SideBandOutputStream(
SideBandOutputStream.CH_PROGRESS, bufsz, rawOut);
pm = new SideBandProgressMonitor(msgOut);
&& req.getClientShallowCommits().isEmpty());
pw.setClientShallowCommits(req.getClientShallowCommits());
pw.setReuseDeltaCommits(true);
- pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA));
- pw.setThin(options.contains(OPTION_THIN_PACK));
+ pw.setDeltaBaseAsOffset(
+ req.getClientCapabilities().contains(OPTION_OFS_DELTA));
+ pw.setThin(req.getClientCapabilities().contains(OPTION_THIN_PACK));
pw.setReuseValidatingObjects(false);
// Objects named directly by references go at the beginning
rw = ow;
}
- if (options.contains(OPTION_INCLUDE_TAG) && allTags != null) {
+ if (req.getClientCapabilities().contains(OPTION_INCLUDE_TAG)
+ && allTags != null) {
for (Ref ref : allTags) {
ObjectId objectId = ref.getObjectId();
if (objectId == null) {