From patchwork Tue Aug 13 12:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?SZEDER_G=C3=A1bor?= X-Patchwork-Id: 11092115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 364D314D5 for ; Tue, 13 Aug 2019 12:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2560227F90 for ; Tue, 13 Aug 2019 12:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1979827FA1; Tue, 13 Aug 2019 12:27:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7959127F90 for ; Tue, 13 Aug 2019 12:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbfHMM1T (ORCPT ); Tue, 13 Aug 2019 08:27:19 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:54463 "EHLO mail-wm1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727969AbfHMM1S (ORCPT ); Tue, 13 Aug 2019 08:27:18 -0400 Received: by mail-wm1-f50.google.com with SMTP id p74so1324911wme.4 for ; Tue, 13 Aug 2019 05:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=trG6jeg+dluOb+roCHGvhIn7E55rk3GXBHIJwae422k=; b=IQZUJ74Gf1O33fwv9opO0wWA4wlt8SZqhfmH2xFMjSK9+jZ9oqPPA59qo3tH4jIB4E rIKt1mnuGZN0FYwSrSWrx6qhde68Yjd7UX6DB1SMttfeqz44ONxqiNx8Xhk6+JU6UCiR qEsqzOAkJAd6q6ik8bPysd/wG2TNvf6ChBSmYnHys4KxjXSlkwv5g2oEJ//Ohl2JXKOl ByJJsnvf/Yzp9P4dm+OFgnCm8V36HSmGSBcnbtyCphxd4v3uek5Cltg0YnBJqQskk+AO bHVi7OzkRCSgTHKjfqQokglBHxF3SNy+7xb0TncFv9KTr66giYeF+KUaP7AvdqPV1byR v14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=trG6jeg+dluOb+roCHGvhIn7E55rk3GXBHIJwae422k=; b=liefGL0PsCh7Yl92n8Z9KM8pqD5F8sOUO3S5DclS0pX12JY3hFf5jAAE8VJTtOc9Eu A0uz7LtDbdglvSY3LX/UDW86jFa4tMTpiImSrzfSW0N1rwHHEp4ysI5z72apMqwo9iQU NKicYZidTZN7Ewe8hQ9gFIW5htclX8YQ4vOe87zTcMXZySEPISx+Vcz4sz7FAMr9xSA7 Te73Jm/TM/2xfNWhX6mpWS8/rlRHYx5rC8kLRte/Tclx2R2s3y+htQpGxpUx/7TZhe4p Z6EDm0UH/Wx1HjL3N1mV3jXE0qgp53hTMMN5c+hTmFybTsNmYCWvBe+nb0I+geWe3yJd HzFw== X-Gm-Message-State: APjAAAX3+ppFLaxb96q6CAnLC26ngWGWrDYEHkdkh5vcRBhZufcn4fYj lDCiIOQelb7XyK5fUfpcP5U= X-Google-Smtp-Source: APXvYqwZkU+hf+7Altu+VWEeU79BwzBo6EFsZ6jE3+KHuUBhaS+L6OTIG8a8XYTi/jpcG3v8CgQMDA== X-Received: by 2002:a7b:c30f:: with SMTP id k15mr2841821wmj.11.1565699236262; Tue, 13 Aug 2019 05:27:16 -0700 (PDT) Received: from localhost.localdomain (x4db44abf.dyn.telefonica.de. [77.180.74.191]) by smtp.gmail.com with ESMTPSA id r5sm1978069wmh.35.2019.08.13.05.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Aug 2019 05:27:15 -0700 (PDT) From: =?utf-8?q?SZEDER_G=C3=A1bor?= To: Junio C Hamano Cc: git@vger.kernel.org, =?utf-8?q?SZEDER_G=C3=A1bor?= Subject: [PATCH 11/11] completion: complete config variables and values for 'git clone --config=' Date: Tue, 13 Aug 2019 14:26:52 +0200 Message-Id: <20190813122652.16468-12-szeder.dev@gmail.com> X-Mailer: git-send-email 2.23.0.rc2.350.gf4fdc32db7 In-Reply-To: <20190813122652.16468-1-szeder.dev@gmail.com> References: <20190813122652.16468-1-szeder.dev@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Completing configuration sections and variable names for the stuck argument of 'git clone --config=' requires a bit of extra care compared to doing the same for the unstuck argument of 'git clone --config ', because we have to deal with that '--config=' being part of the current word to be completed. Add an option to the __git_complete_config_variable_name_and_value() and in turn to the __git_complete_config_variable_name() helper functions to specify the current section/variable name to be completed, so they can be used even when completing the stuck argument of '--config='. __git_complete_config_variable_value() already has such an option, and thus no further changes were necessary to complete possible values after 'git clone --config=section.name='. Signed-off-by: SZEDER Gábor --- contrib/completion/git-completion.bash | 66 +++++++++++++++++++------- t/t9902-completion.sh | 21 ++++++++ 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 279f04df87..ce7ff0a96d 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1406,6 +1406,11 @@ _git_clone () ;; esac case "$cur" in + --config=*) + __git_complete_config_variable_name_and_value \ + --cur="${cur##--config=}" + return + ;; --*) __gitcomp_builtin clone return @@ -2352,35 +2357,41 @@ __git_complete_config_variable_value () # Completes configuration sections, subsections, variable names. # # Usage: __git_complete_config_variable_name [