From patchwork Sun Mar 17 18:16:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10856501 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 C2EA4139A for ; Sun, 17 Mar 2019 18:16:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC147292BE for ; Sun, 17 Mar 2019 18:16:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E6D7292C3; Sun, 17 Mar 2019 18:16:36 +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,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 BBD37292BE for ; Sun, 17 Mar 2019 18:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726677AbfCQSQc (ORCPT ); Sun, 17 Mar 2019 14:16:32 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:55193 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfCQSQc (ORCPT ); Sun, 17 Mar 2019 14:16:32 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 5A54A61173; Sun, 17 Mar 2019 14:16:30 -0400 (EDT) (envelope-from tmz@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=p6MwUhd+IOJG2/En24yWXLyWu +4=; b=aLthoAckiABsIoK2xne7G4kNhF8UMA+wW3g3XVvqYONDQUpBz91arApoD /gP+TEgsb54QAj31prHJNJKSVRwoV1kTqM5vOZKX2ysfuSS86R2vJLEA51kRYlxD JpfF2Bz1P8HvU+A/1y8vBgMKlz+3iumjptZGv1cx/UyFhHQ6ok= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; q=dns; s=sasl; b=gOwxuUdaWjgcKAaxTHt C2sPQff6J08UMsBKrNaUeg5Sr2MCD8rizniTs9QAEPd4gFKXdw6g3q10irYYX07C r3nq0gwrftyAF3ESjLsv0M86H5s9QczgqVHV0EINH1lY4rKw+TvVK7aKqRMTjujM S0p5U+TUiCrP+FKGPOgcaUUw= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 52A3B61172; Sun, 17 Mar 2019 14:16:30 -0400 (EDT) (envelope-from tmz@pobox.com) Received: from morphine.paradise.teonanacatl.net (unknown [47.202.93.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id C7A856116C; Sun, 17 Mar 2019 14:16:25 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v2 1/4] git: read local config in --list-cmds Date: Sun, 17 Mar 2019 14:16:17 -0400 Message-Id: <20190317181620.26727-2-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: C7D1AF84-48E0-11E9-BF85-EE24A11ADF13-09356542!pb-smtp21.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff King Normally code that is checking config before we've decided to do setup_git_directory() would use read_early_config(), which uses discover_git_directory() to tentatively see if we're in a repo, and if so to add it to the config sequence. But list_cmds() uses the caching configset mechanism which rightly does not use read_early_config(), because it has no idea if it's being called early. Call setup_git_directory_gently() so we can pick up repo-level config (like completion.commands). Signed-off-by: Jeff King --- git.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git.c b/git.c index 2dd588674f..10e49d79f6 100644 --- a/git.c +++ b/git.c @@ -62,6 +62,13 @@ static int list_cmds(const char *spec) { struct string_list list = STRING_LIST_INIT_DUP; int i; + int nongit; + + /* + * Set up the repository so we can pick up any repo-level config (like + * completion.commands). + */ + setup_git_directory_gently(&nongit); while (*spec) { const char *sep = strchrnul(spec, ','); From patchwork Sun Mar 17 18:16:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10856503 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 C08EF139A for ; Sun, 17 Mar 2019 18:16:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB241292BE for ; Sun, 17 Mar 2019 18:16:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F6C6292C2; Sun, 17 Mar 2019 18:16:37 +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,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 5399C292BE for ; Sun, 17 Mar 2019 18:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbfCQSQg (ORCPT ); Sun, 17 Mar 2019 14:16:36 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:56933 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfCQSQf (ORCPT ); Sun, 17 Mar 2019 14:16:35 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id DFFE061177; Sun, 17 Mar 2019 14:16:33 -0400 (EDT) (envelope-from tmz@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=0rvIC7fYpfxc6DKg/gv+hcNkE NI=; b=apUCWvzwPeXwpqQ/gFNbyqbfZRpbI2n0fb1A8ar9MzQnhwlHtuEGiVJ8H SFvMmmMf1m0mqrgQ20Ub9uItXTK+/PuI+AYfiJym4k9LxNQFIA16VSvaA4HeUN97 TtAmSAFene3CnJdLQy9SYNx5WH6eH1z9FUCAdXNTA9v0LI50os= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; q=dns; s=sasl; b=Jd826Vk0dQK4vLzykTN TSar28lu5FgWa4QahdWO5C19rKkGJR4Fw9Y5TQbtHSHpT5rSMZAjTkYTiEiXxM6e O0av5aofxmkyDjVkjjjcwh3fNqsKYqv5iu9NgxPG78UO3IuPQxqR0eG2CLuG8xEd MS0s6oI5lxr3+MeHgA69m9Hw= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id D95F061175; Sun, 17 Mar 2019 14:16:33 -0400 (EDT) (envelope-from tmz@pobox.com) Received: from morphine.paradise.teonanacatl.net (unknown [47.202.93.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 5809861171; Sun, 17 Mar 2019 14:16:29 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Cc: git@vger.kernel.org, Junio C Hamano , Jeff King , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v2 2/4] t9902: test multiple removals via completion.commands Date: Sun, 17 Mar 2019 14:16:18 -0400 Message-Id: <20190317181620.26727-3-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: C9EDA3B8-48E0-11E9-9686-EE24A11ADF13-09356542!pb-smtp21.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 6532f3740b ("completion: allow to customize the completable command list", 2018-05-20) added the completion.commands config variable. Multiple commands may be added or removed, separated by a space. Demonstrate the failure of multiple removals. Signed-off-by: Todd Zullinger --- t/t9902-completion.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 3a2c6326d8..3f5b420bf8 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1483,6 +1483,12 @@ test_expect_success 'git --help completion' ' test_completion "git --help core" "core-tutorial " ' +test_expect_failure 'completion.commands removes multiple commands' ' + test_config completion.commands "-cherry -mergetool" && + git --list-cmds=list-mainporcelain,list-complete,config >out && + ! grep -E "^(cherry|mergetool)$" out +' + test_expect_success 'setup for integration tests' ' echo content >file1 && echo more >file2 && From patchwork Sun Mar 17 18:16:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10856507 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 5E756139A for ; Sun, 17 Mar 2019 18:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4791F292BE for ; Sun, 17 Mar 2019 18:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C5CA292C2; Sun, 17 Mar 2019 18:16:41 +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,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 DC1A5292BE for ; Sun, 17 Mar 2019 18:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727236AbfCQSQj (ORCPT ); Sun, 17 Mar 2019 14:16:39 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:62707 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727111AbfCQSQj (ORCPT ); Sun, 17 Mar 2019 14:16:39 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 6F36C6117B; Sun, 17 Mar 2019 14:16:37 -0400 (EDT) (envelope-from tmz@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=ASB1GIPocT3yhzbI8mvz7V74w Og=; b=aARdGs3/z8eHf5BlnyQ2LPk7uLtbr0RlInvHNq7EJ/R8nDLBwqYlOHgoN /qtzlMhJSkUuANt9oHFofotV3y7pb7GlTEdOL2X48NMINy7l40gYETky/yoj5jLN lAKPR+zliKtkPiZbSxs4KQPx7IivfF/8iDJEGhlrvRYsGgQPtg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; q=dns; s=sasl; b=b1HA4xz1W89oVBCaReX D4Zh2JYYL55Ml39evZ1+pdVFM860D8qUqrEy5HNTXWrVxvqPLLgvRBBIEBwOePF/ 7zJyt6KNpq+pkuse2hrjGTFCPNowhUpdhh3TQwfPRHYCJogxhJyY17wAiMexvw0h m3KtaQq3/VE1k9nbxOJqPekE= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 669D86117A; Sun, 17 Mar 2019 14:16:37 -0400 (EDT) (envelope-from tmz@pobox.com) Received: from morphine.paradise.teonanacatl.net (unknown [47.202.93.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id D8D7C61174; Sun, 17 Mar 2019 14:16:32 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v2 3/4] completion: fix multiple command removals Date: Sun, 17 Mar 2019 14:16:19 -0400 Message-Id: <20190317181620.26727-4-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: CC08AC38-48E0-11E9-8335-EE24A11ADF13-09356542!pb-smtp21.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff King Commit 6532f3740b ("completion: allow to customize the completable command list", 2018-05-20) tried to allow multiple space-separated entries in completion.commands. To do this, it copies each parsed token into a strbuf so that the result is NUL-terminated. However, for tokens starting with "-", it accidentally passes the original non-terminated string, meaning that only the final one worked. Switch to using the strbuf. Reported-by: Todd Zullinger Signed-off-by: Jeff King --- help.c | 4 ++-- t/t9902-completion.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/help.c b/help.c index 520c9080e8..026f881715 100644 --- a/help.c +++ b/help.c @@ -393,8 +393,8 @@ void list_cmds_by_config(struct string_list *list) const char *p = strchrnul(cmd_list, ' '); strbuf_add(&sb, cmd_list, p - cmd_list); - if (*cmd_list == '-') - string_list_remove(list, cmd_list + 1, 0); + if (sb.buf[0] == '-') + string_list_remove(list, sb.buf + 1, 0); else string_list_insert(list, sb.buf); strbuf_release(&sb); diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 3f5b420bf8..050fac4fff 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1483,7 +1483,7 @@ test_expect_success 'git --help completion' ' test_completion "git --help core" "core-tutorial " ' -test_expect_failure 'completion.commands removes multiple commands' ' +test_expect_success 'completion.commands removes multiple commands' ' test_config completion.commands "-cherry -mergetool" && git --list-cmds=list-mainporcelain,list-complete,config >out && ! grep -E "^(cherry|mergetool)$" out From patchwork Sun Mar 17 18:16:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10856509 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 D5DF5139A for ; Sun, 17 Mar 2019 18:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1967292BE for ; Sun, 17 Mar 2019 18:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B62BE292C2; Sun, 17 Mar 2019 18:16:44 +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,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 57331292BE for ; Sun, 17 Mar 2019 18:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727241AbfCQSQn (ORCPT ); Sun, 17 Mar 2019 14:16:43 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:64173 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbfCQSQn (ORCPT ); Sun, 17 Mar 2019 14:16:43 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 0C15E6117E; Sun, 17 Mar 2019 14:16:41 -0400 (EDT) (envelope-from tmz@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=sasl; bh=Kn9416gq4Y08 kXKQoYqGoNeeWdI=; b=URkfy4aPF3GQAo1kWRvTD7nJJu0DAg6Wkks9s1by3StF uLD93vkxdNO37EXXYjf4nwiq/4KFN7dzIXqtOXuyDXVPmIq6xS3RZl9z8HYkW2Do /cEbFmPNyouZ2MXvzwO/Zzo1DBu/JtZ7bNtgSZP2Xdkd1M0XVxU5MWu43yc56s0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=iqtgGR 9BomQC5kY7XOzbkRLtUpM1Qh31SqxKR4I975eel69ub3bNrgBGWSFsTRX1l6ZSSi l3SbTxc2J8s+rkjaVw+GM9CXJyazq7aHOStYQCbbkoPlO4AEinHzvgrwnwROvUsv DkSExiF676Q39RwhcQeURBmSqSXn9JKL+wElI= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 046606117D; Sun, 17 Mar 2019 14:16:41 -0400 (EDT) (envelope-from tmz@pobox.com) Received: from morphine.paradise.teonanacatl.net (unknown [47.202.93.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 67B1661179; Sun, 17 Mar 2019 14:16:36 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= Cc: git@vger.kernel.org, Junio C Hamano , Jeff King , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v2 4/4] completion: use __git when calling --list-cmds Date: Sun, 17 Mar 2019 14:16:20 -0400 Message-Id: <20190317181620.26727-5-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: CE23A90A-48E0-11E9-B462-EE24A11ADF13-09356542!pb-smtp21.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since e51bdea6d3 ("git: read local config in --list-cmds", 2019-03-01), the completion.commands variable respects repo-level configuration. Use __git which ensures that the proper repo config is consulted if the command line contains 'git -C /some/other/repo'. Suggested-by: SZEDER Gábor Signed-off-by: Todd Zullinger --- Junio, I referenc the commit id for "git: read local config in --list-cmds" which is earlier in this series, so the id will, of course, differ when you apply it. Let me know if you'd prefer this commit to be dropped and resent once the others in the series are applied or if it's easy for you to adjust when it's queued. Also, as I wrote in an earlier reply, at the moment, I think using __git only matters for calls where config is in the --list-cmds list. But since Jeff's fix affects all --list-cmds calls, it seems prudent to adjust the 3 other uses of --list-cmds in the completion script. contrib/completion/git-completion.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 499e56f83d..e505f04ff7 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1010,7 +1010,7 @@ __git_all_commands= __git_compute_all_commands () { test -n "$__git_all_commands" || - __git_all_commands=$(git --list-cmds=main,others,alias,nohelpers) + __git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers) } # Lists all set config variables starting with the given section prefix, @@ -1620,9 +1620,9 @@ _git_help () esac if test -n "$GIT_TESTING_ALL_COMMAND_LIST" then - __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(git --list-cmds=alias,list-guide) gitk" + __gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk" else - __gitcomp "$(git --list-cmds=main,nohelpers,alias,list-guide) gitk" + __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk" fi } @@ -2888,7 +2888,7 @@ __git_main () then __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" else - __gitcomp "$(git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" + __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" fi ;; esac