From: Drew DeVault Date: Tue, 18 Feb 2020 20:09:14 GMT Subject: [PATCH v2] push: introduce --push-option-if-able Message-ID: <20200218200913.128519-1-sir@cmpwn.com> This introduces a --push-option-if-able, and along with it updates send-pack, transport, push, etc to track the list of push options specified via this flag. These options will be used if the remote supports push options, but will not cause the push operation to terminate if the remote does not support push options. This is desirable in the following scenario: you frequently use two git hosts, A and B, of which only B supports push options. If you wish to set a push option globally (via git config push.pushOptions), any attempts to push to host A will fail, requiring you to explicitly override it at the command line. This renders the push.pushOption config value basically useless for a lot of users. Signed-off-by: Drew DeVault --- Previous version of this patch made --push-option non-fatal in the face of a server which does not support push options. Following feedback that this might be risky when the push options are relied upon to prevent some undesirable default behavior from occuring, I've implemented the suggested --push-option-if-able as an alternative. Thanks to Jeff King for the review. It was also suggested to add remote.*.pushOption{,IfAble}, but seeing as remote.*.pushOption is not presently supported I think this is best saved for a later patch (it's definitely a good idea, though). Documentation/config/push.txt | 6 +++++ Documentation/git-push.txt | 14 +++++++++++- Documentation/git-receive-pack.txt | 10 +++++++++ Documentation/githooks.txt | 3 ++- builtin/push.c | 35 +++++++++++++++++++++++++----- send-pack.c | 9 ++++++-- send-pack.h | 2 +- submodule.c | 11 +++++++++- submodule.h | 1 + transport-helper.c | 3 +++ transport.c | 2 ++ transport.h | 5 +++++ 12 files changed, 90 insertions(+), 11 deletions(-) diff --git a/Documentation/config/push.txt b/Documentation/config/push.txt index 54871f8213..6ad0c6808a 100644 --- a/Documentation/config/push.txt +++ b/Documentation/config/push.txt @@ -99,6 +99,12 @@ This will result in only b (a and c are cleared). -- +push.pushOptionIfAble:: + When no `--push-option-if-able=