push: Do not use push options unless requested

Unless the user passed --push-option, the client does not intend to
pass push options to the server.

Without this change, all pushes to servers without push option support
fail.

Not enabling the feature (instead of enabling it and sending an empty
list of options) in this case is more intuitive and matches the
behavior of C git push's --push-option parameter better.

Bug: 500149
Change-Id: Ia4f13840cc54d8ba54e99b1432108f1c43022c53
Signed-off-by: Stefan Beller <sbeller@google.com>
This commit is contained in:
Stefan Beller 2016-08-24 12:47:10 -07:00 committed by Jonathan Nieder
parent edd8ad4d04
commit 609de52600
1 changed files with 3 additions and 1 deletions

View File

@ -130,7 +130,9 @@ protected void run() throws Exception {
push.setThin(thin);
push.setAtomic(atomic);
push.setTimeout(timeout);
push.setPushOptions(pushOptions);
if (!pushOptions.isEmpty()) {
push.setPushOptions(pushOptions);
}
Iterable<PushResult> results = push.call();
for (PushResult result : results) {
try (ObjectReader reader = db.newObjectReader()) {