From patchwork Wed Mar 20 18:03:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10862355 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 E16F81708 for ; Wed, 20 Mar 2019 18:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C703A29D0D for ; Wed, 20 Mar 2019 18:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB47B29D10; Wed, 20 Mar 2019 18:03:43 +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 66D3B29D0D for ; Wed, 20 Mar 2019 18:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727241AbfCTSDm (ORCPT ); Wed, 20 Mar 2019 14:03:42 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:61318 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbfCTSDl (ORCPT ); Wed, 20 Mar 2019 14:03:41 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 61F3455F19; Wed, 20 Mar 2019 14:03:39 -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=e+ERwF9EYJ9pyQhKrJl7PR4qr nI=; b=GWz5yOsAxfT3i/QC0KYRTU5JDurZ4R8nNchI5znZ3Puorm8WstOJ5WbqI ONjIgRqmzHONfk1p5+kbeBmhWZgJL8B5hy6C0E9iZXAt2V2viCWxbsR9HEXQlLOI K/CBiavaSH0MtpvaTVj8JzH/OKgbe+tn4ksEgMPc9LSEwFnaHk= 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=JPeJbqdhFTs2SfTUTcm NiyiJfZJcyms6dUgQyavozLD68KcpxCPbBCY8lVATPOk4QmnpzlyJCBBGX+fruIm /GG9NwzEg2Ym7gpOxWXXR47J1Dj3Bp6yWQV4pY56m/Id/tJev3IKhH3ocqLxU6IJ dbTemQxX/OxwjS3l/jEEwERA= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 5A3D755F17; Wed, 20 Mar 2019 14:03:39 -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 C41EF55F13; Wed, 20 Mar 2019 14:03:34 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Duy Nguyen Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v3 1/4] git: read local config in --list-cmds Date: Wed, 20 Mar 2019 14:03:26 -0400 Message-Id: <20190320180329.22280-2-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: 7B7F8B18-4B3A-11E9-A628-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 +++++++ help.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) 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, ','); diff --git a/help.c b/help.c index 520c9080e8..fac7e421d0 100644 --- a/help.c +++ b/help.c @@ -375,13 +375,6 @@ void list_cmds_by_config(struct string_list *list) { const char *cmd_list; - /* - * There's no actual repository setup at this point (and even - * if there is, we don't really care; only global config - * matters). If we accidentally set up a repository, it's ok - * too since the caller (git --list-cmds=) should exit shortly - * anyway. - */ if (git_config_get_string_const("completion.commands", &cmd_list)) return; From patchwork Wed Mar 20 18:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10862359 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 737AC1515 for ; Wed, 20 Mar 2019 18:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C0A129D0D for ; Wed, 20 Mar 2019 18:03:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5026429D10; Wed, 20 Mar 2019 18:03:47 +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 EDE5429D0D for ; Wed, 20 Mar 2019 18:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727257AbfCTSDp (ORCPT ); Wed, 20 Mar 2019 14:03:45 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:56953 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbfCTSDp (ORCPT ); Wed, 20 Mar 2019 14:03:45 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 020D555F1F; Wed, 20 Mar 2019 14:03:43 -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=H22coXQXZKEId0a+aXUnk+HtKNMQY5380qjy5DuswRphQ1g501rm3SUOD MDZ/lOsFFfBT3e+dYaVLvLkGUD4VuEJXXIhuANZuyuuQsoHVstRu5jNry0D79wW7 8F/2IpkNqch9cr6g6IU6Nvn/ZO7TEgwq7G1eoXK8k1bjX0yDTU= 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=KdNiLWhGHZHJYsUnFdX LlODTzq3nWDF6LS6EDoWD4aluTGq80UW2XVbFyPEtqzZtaVnIUNR1xAhFOWZGCJ4 FamOwPVeMB9zjXqsYunbWuuI700riCY9jyxfd9ETBYox8juPILBxnXOaDQ4ZXSbv B6rZXmzAc+Cl4s1dayMcf/Ig= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id DC8E755F1E; Wed, 20 Mar 2019 14:03:42 -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 595F255F16; Wed, 20 Mar 2019 14:03:38 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Duy Nguyen Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v3 2/4] t9902: test multiple removals via completion.commands Date: Wed, 20 Mar 2019 14:03:27 -0400 Message-Id: <20190320180329.22280-3-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: 7D9FB652-4B3A-11E9-B58A-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 Wed Mar 20 18:03:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10862361 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 47D191575 for ; Wed, 20 Mar 2019 18:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E29629D0E for ; Wed, 20 Mar 2019 18:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22B7029D8D; Wed, 20 Mar 2019 18:03:51 +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 C23EE29D0E for ; Wed, 20 Mar 2019 18:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727271AbfCTSDt (ORCPT ); Wed, 20 Mar 2019 14:03:49 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:62403 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbfCTSDq (ORCPT ); Wed, 20 Mar 2019 14:03:46 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 7CF0455F25; Wed, 20 Mar 2019 14:03:46 -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=YkLFDYSxyURvp0Vo1uDEQQXRb T8=; b=ugZldrLSisfCx4arLD9toeQTuOysHPmADjOrLMXcXsEjv0eOXgK4Q9eoU a2P3vSi+N6vTzRcfhELsVvcVr824593L6EeBTLHxWg5wNAvhc2ID3yNeUk82y369 2NL78W2cdhYGns9mz+HVNNAM9PgVHEtcycnU8baQAg+L4ekTX8= 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=SQo9vYZ4uff3isQgYen moloNeJ1uVNKWFI4PKgT/e6E7XDBxJ1pUzp6gUZhsV4kzBhPnFQG0QZriuFlY7oN iShUxI0ft6mzILYGpkSQ+hh8/s0dJIH41QUrJlIbfBJgqUaLSM7mWJbWNgDEAi44 GJ2WftsvPwr18Tt9aYp3Y7mo= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 7697955F24; Wed, 20 Mar 2019 14:03:46 -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 DB74255F1C; Wed, 20 Mar 2019 14:03:41 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Duy Nguyen Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v3 3/4] completion: fix multiple command removals Date: Wed, 20 Mar 2019 14:03:28 -0400 Message-Id: <20190320180329.22280-4-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: 7FB9D288-4B3A-11E9-9479-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 fac7e421d0..a9e451f2ee 100644 --- a/help.c +++ b/help.c @@ -386,8 +386,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 Wed Mar 20 18:03:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10862363 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 E11C81575 for ; Wed, 20 Mar 2019 18:03:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C93A429D0D for ; Wed, 20 Mar 2019 18:03:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD3F429D8D; Wed, 20 Mar 2019 18:03:54 +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 A8D0329D0D for ; Wed, 20 Mar 2019 18:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbfCTSDw (ORCPT ); Wed, 20 Mar 2019 14:03:52 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:50297 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfCTSDw (ORCPT ); Wed, 20 Mar 2019 14:03:52 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id F3E6855F3F; Wed, 20 Mar 2019 14:03:49 -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=sVYEvg+BXKIL B1Kpj0ZZj6kLoCs=; b=J4puk/adEDoJQ/fq8XyC2xYF+kL0EZ7+ChV1kHHsM/xu Wzbb7EgjH1uIUfq7yGhGnQs7nSVQkCtxhgIHnT5+xj13oHCwu1SCwuJWc/fiVLuu pN4Uk3In69ly9qJmnF06dsq6bowptTLunqkJY9UOOLN6zXG6m2FuQr76zk7Q8Og= 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=LupNso B39+ebQV6k7AQvFWkqMv2zkyYUq+JsPzAaHVPsnTogAgsKjD8wyfN90+hUEBVHkB EiGkj3Cxp+7LyUrkjsj6DqwHD5bGW6KVGRduT+O9+Zpd0BZMdm26nHkUiIKA5+tf EjxmcTZiU8BH8n2IPAc/OCvUCGgfTcZY56J08= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id ED02955F3E; Wed, 20 Mar 2019 14:03:49 -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 6937955F22; Wed, 20 Mar 2019 14:03:45 -0400 (EDT) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Duy Nguyen Cc: Jeff King , git@vger.kernel.org, Junio C Hamano , =?utf-8?q?SZEDER_G=C3=A1bor?= , Eric Sunshine Subject: [PATCH v3 4/4] completion: use __git when calling --list-cmds Date: Wed, 20 Mar 2019 14:03:29 -0400 Message-Id: <20190320180329.22280-5-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: 81D57266-4B3A-11E9-B190-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 --- 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