From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1875C34047 for ; Tue, 18 Feb 2020 20:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CD6B2067D for ; Tue, 18 Feb 2020 20:11:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=cmpwn.com header.i=@cmpwn.com header.b="D+PgYtDQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgBRULJ (ORCPT ); Tue, 18 Feb 2020 15:11:09 -0500 Received: from mail.cmpwn.com ([45.56.77.53]:58738 "EHLO mail.cmpwn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgBRULJ (ORCPT ); Tue, 18 Feb 2020 15:11:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cmpwn.com; s=cmpwn; t=1582056665; bh=2+HbzB/LO0nVyr4wCi7eONdH1Y5Fx2CdqR1o5/aVkUU=; h=From:To:Cc:Subject:Date; b=D+PgYtDQTTh4Trjo1m+5fh96YQexFnCwuWLZn2fsk8N3QxmyC4I73L+hodxQh/YRu +SJ9sQ/eJD+EEoWvgRYF2ERDG/Xq1uMn+t/JcF/MWLRo5kgoUdbi/MDv/vNbfGK4DB oWBkfTyirybyenvpfvAuXWz++kM6B5KoqpKg/lvE= From: Drew DeVault To: git@vger.kernel.org Cc: Drew DeVault , "Jeff King" , Stefan Beller , Junio C Hamano Subject: [PATCH v2] push: introduce --push-option-if-able Date: Tue, 18 Feb 2020 15:09:14 -0500 Message-Id: <20200218200913.128519-1-sir@cmpwn.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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=