ReceivePack: simplify getPushOptions
Checking if the instance allows push options before returning the collection or null is a bit overkill. Just return the collection or return null. Change-Id: Icdc3755194373966e5819284aeb9bfe8dd34de82
This commit is contained in:
parent
8e00a317b2
commit
2fd4559773
|
@ -96,24 +96,18 @@ public ReceivePack(final Repository into) {
|
||||||
* Gets an unmodifiable view of the option strings associated with the push.
|
* Gets an unmodifiable view of the option strings associated with the push.
|
||||||
*
|
*
|
||||||
* @return an unmodifiable view of pushOptions, or null (if pushOptions is).
|
* @return an unmodifiable view of pushOptions, or null (if pushOptions is).
|
||||||
* @throws IllegalStateException
|
|
||||||
* if allowPushOptions has not been set to true.
|
|
||||||
* @since 4.5
|
* @since 4.5
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<String> getPushOptions() {
|
public List<String> getPushOptions() {
|
||||||
if (!isAllowPushOptions()) {
|
if (isAllowPushOptions() && usePushOptions) {
|
||||||
// Reading push options without a prior setAllowPushOptions(true)
|
return Collections.unmodifiableList(pushOptions);
|
||||||
// call doesn't make sense.
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
}
|
||||||
if (!usePushOptions) {
|
|
||||||
// The client doesn't support push options. Return null to
|
// The client doesn't support push options. Return null to
|
||||||
// distinguish this from the case where the client declared support
|
// distinguish this from the case where the client declared support
|
||||||
// for push options and sent an empty list of them.
|
// for push options and sent an empty list of them.
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return Collections.unmodifiableList(pushOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue