Fix push option initalization on HTTP
Initialize pushOptions when we decide to use them, instead of when we advertise them. In the case of HTTP the advertisement is in a different network request, hence in a different instance of the BaseReceivePack. Change-Id: I094c60942e04de82cb6d8433c9cd43a46ffae332 Signed-off-by: Stefan Beller <sbeller@google.com>
This commit is contained in:
parent
3b64c09ac4
commit
36cf4fe580
|
@ -220,7 +220,7 @@ public void testFailedAtomicPushWithOptions() throws Exception {
|
||||||
one.getStatus());
|
one.getStatus());
|
||||||
assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED,
|
assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED,
|
||||||
two.getStatus());
|
two.getStatus());
|
||||||
assertEquals(new ArrayList<String>(), baseReceivePack.getPushOptions());
|
assertNull(baseReceivePack.getPushOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1152,7 +1152,6 @@ public void sendAdvertisedRefs(final RefAdvertiser adv)
|
||||||
adv.advertiseCapability(CAPABILITY_OFS_DELTA);
|
adv.advertiseCapability(CAPABILITY_OFS_DELTA);
|
||||||
if (allowPushOptions) {
|
if (allowPushOptions) {
|
||||||
adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS);
|
adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS);
|
||||||
pushOptions = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
adv.advertiseCapability(OPTION_AGENT, UserAgent.get());
|
adv.advertiseCapability(OPTION_AGENT, UserAgent.get());
|
||||||
adv.send(getAdvertisedOrDefaultRefs());
|
adv.send(getAdvertisedOrDefaultRefs());
|
||||||
|
@ -1272,6 +1271,9 @@ protected void enableCapabilities() {
|
||||||
quiet = allowQuiet && isCapabilityEnabled(CAPABILITY_QUIET);
|
quiet = allowQuiet && isCapabilityEnabled(CAPABILITY_QUIET);
|
||||||
usePushOptions = allowPushOptions
|
usePushOptions = allowPushOptions
|
||||||
&& isCapabilityEnabled(CAPABILITY_PUSH_OPTIONS);
|
&& isCapabilityEnabled(CAPABILITY_PUSH_OPTIONS);
|
||||||
|
if (usePushOptions) {
|
||||||
|
pushOptions = new ArrayList<>();
|
||||||
|
}
|
||||||
if (sideBand) {
|
if (sideBand) {
|
||||||
OutputStream out = rawOut;
|
OutputStream out = rawOut;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue