diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java index 1554f8430..8ff022618 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java @@ -220,7 +220,7 @@ public class PushOptionsTest extends RepositoryTestCase { one.getStatus()); assertSame(RemoteRefUpdate.Status.REJECTED_REMOTE_CHANGED, two.getStatus()); - assertEquals(new ArrayList(), baseReceivePack.getPushOptions()); + assertNull(baseReceivePack.getPushOptions()); } @Test diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 4bd3af2f8..825e294d9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -1152,7 +1152,6 @@ public abstract class BaseReceivePack { adv.advertiseCapability(CAPABILITY_OFS_DELTA); if (allowPushOptions) { adv.advertiseCapability(CAPABILITY_PUSH_OPTIONS); - pushOptions = new ArrayList<>(); } adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.send(getAdvertisedOrDefaultRefs()); @@ -1272,6 +1271,9 @@ public abstract class BaseReceivePack { quiet = allowQuiet && isCapabilityEnabled(CAPABILITY_QUIET); usePushOptions = allowPushOptions && isCapabilityEnabled(CAPABILITY_PUSH_OPTIONS); + if (usePushOptions) { + pushOptions = new ArrayList<>(); + } if (sideBand) { OutputStream out = rawOut;