diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index cea004b51..2e3d74a14 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -96,24 +96,18 @@ public ReceivePack(final Repository into) { * Gets an unmodifiable view of the option strings associated with the push. * * @return an unmodifiable view of pushOptions, or null (if pushOptions is). - * @throws IllegalStateException - * if allowPushOptions has not been set to true. * @since 4.5 */ @Nullable public List getPushOptions() { - if (!isAllowPushOptions()) { - // Reading push options without a prior setAllowPushOptions(true) - // call doesn't make sense. - throw new IllegalStateException(); + if (isAllowPushOptions() && usePushOptions) { + return Collections.unmodifiableList(pushOptions); } - if (!usePushOptions) { - // The client doesn't support push options. Return null to - // distinguish this from the case where the client declared support - // for push options and sent an empty list of them. - return null; - } - return Collections.unmodifiableList(pushOptions); + + // The client doesn't support push options. Return null to + // distinguish this from the case where the client declared support + // for push options and sent an empty list of them. + return null; } /**