From patchwork Fri Mar 1 17:34:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10835767 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 758D6139A for ; Fri, 1 Mar 2019 17:34:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57EED2EE86 for ; Fri, 1 Mar 2019 17:34:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48B192EEC3; Fri, 1 Mar 2019 17:34:57 +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 DF9A02EE86 for ; Fri, 1 Mar 2019 17:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388731AbfCARez (ORCPT ); Fri, 1 Mar 2019 12:34:55 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:50453 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388333AbfCARez (ORCPT ); Fri, 1 Mar 2019 12:34:55 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 32E6243191; Fri, 1 Mar 2019 12:34:53 -0500 (EST) (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=w1MegZGq7DiH3DoJ3U7+MBi1k XU=; b=jbcmGOnqes/gVoBu1BpnbOvO5TnxWiNrkaWFAKy9P/9KyXLHm0mMaNkbE MbAUI8gVFeG7OVkBZukwoXLrwlTDaCae/QxbPK89TFqwbAm/7xjVtH5tsF3RvDU2 y0J0Fv7KosPqmZnveZvW//nY2WJjXd1thNsSKr2BbAhjcw6OGE= 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=NTQrrJkIs6x3WKu1L/R kWdWRkjXodKv/QfvYideL9S8KC0z0Bzhn7wZaIg1KxnIjwUDoeaPnLCmz7jyzH+X rTRTd0x/Bg7S3u1jNAyJYD7PZZ4TqVkzKxnkCMM2F7XzyS+1OW7I3q6oBpVzWGST VHPv4AIaNQmyRzl8+Ng2Vj0g= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 2B97D43190; Fri, 1 Mar 2019 12:34:53 -0500 (EST) (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 CC5D74318C; Fri, 1 Mar 2019 12:34:48 -0500 (EST) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Jeff King Cc: git@vger.kernel.org, =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= , =?utf-8?q?SZEDER_G=C3=A1bor?= Subject: [PATCH 1/3] doc: note config file restrictions for completion.commands Date: Fri, 1 Mar 2019 12:34:41 -0500 Message-Id: <20190301173443.16429-2-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190228230506.GA20625@sigill.intra.peff.net> References: <20190228230506.GA20625@sigill.intra.peff.net> MIME-Version: 1.0 X-Pobox-Relay-ID: 50C7C4CC-3C48-11E9-B4AC-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 The completion.commands config var must be set in either the system-wide or global config file. The completion script does not read a local repository config. Signed-off-by: Todd Zullinger --- Documentation/config/completion.txt | 3 ++- Documentation/git.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/config/completion.txt b/Documentation/config/completion.txt index 4d99bf33c9..4859d18e86 100644 --- a/Documentation/config/completion.txt +++ b/Documentation/config/completion.txt @@ -4,4 +4,5 @@ completion.commands:: porcelain commands and a few select others are completed. You can add more commands, separated by space, in this variable. Prefixing the command with '-' will remove it from - the existing list. + the existing list. The variable must be set in either the + system-wide or global config. diff --git a/Documentation/git.txt b/Documentation/git.txt index 00156d64aa..638f4d6cc9 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -172,7 +172,8 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config others (all other commands in `$PATH` that have git- prefix), list- (see categories in command-list.txt), nohelpers (exclude helper commands), alias and config - (retrieve command list from config variable completion.commands) + (retrieve command list from config variable completion.commands, + set in the global or system-wide config file) GIT COMMANDS ------------ From patchwork Fri Mar 1 17:34:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10835769 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 C9460139A for ; Fri, 1 Mar 2019 17:35:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADD332EE4B for ; Fri, 1 Mar 2019 17:35:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A135E2EE8A; Fri, 1 Mar 2019 17:35:00 +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 3E21A2EE4B for ; Fri, 1 Mar 2019 17:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388775AbfCARe7 (ORCPT ); Fri, 1 Mar 2019 12:34:59 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:62068 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388333AbfCARe6 (ORCPT ); Fri, 1 Mar 2019 12:34:58 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 8AACD43195; Fri, 1 Mar 2019 12:34:56 -0500 (EST) (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=FVCd3kzDIr78oQASlHX0wgs0+ Ro=; b=uG0jpW5hz9OEI/Z0LIg3yIpFC9hDC3bG1rsWYuel5KkAgjbjPeTrvgJpY pLtD6taMNQ037ewGxWfl25tZ6tI0n7tZ3Blmgt336aTuKENxWTSUi8quOr2ceDWG /kG/xKzYAog7spz2kiF+CY0rL4EzlwkjAZaM29xbTYByrZWfcs= 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=ErZzckNHkemV4rq9ihD 2FLjZc7Ve6IVqjc5VbkPQtWJLgqPzrIuaRB3GVK1mNIUCFzfyJgsbvppyvV0x2zJ Ac99BT3sLnffkuHwj6qEqJxs6tvdg+acjJs2RucAcSBgFFjDFS2jV7bxScPu8HWy JeSpl8aF00wWRHxvR0M9V7j4= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 8271643194; Fri, 1 Mar 2019 12:34:56 -0500 (EST) (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 2846C4318F; Fri, 1 Mar 2019 12:34:52 -0500 (EST) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Jeff King Cc: git@vger.kernel.org, =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= , =?utf-8?q?SZEDER_G=C3=A1bor?= Subject: [PATCH 2/3] t9902: test multiple removals via completion.commands Date: Fri, 1 Mar 2019 12:34:42 -0500 Message-Id: <20190301173443.16429-3-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190228230506.GA20625@sigill.intra.peff.net> References: <20190228230506.GA20625@sigill.intra.peff.net> MIME-Version: 1.0 X-Pobox-Relay-ID: 52C41122-3C48-11E9-8FCD-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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 3a2c6326d8..dd11bb660d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1483,6 +1483,14 @@ test_expect_success 'git --help completion' ' test_completion "git --help core" "core-tutorial " ' +test_expect_failure 'completion.commands removes multiple commands' ' + echo cherry-pick >expected && + test_config_global completion.commands "-cherry -mergetool" && + git --list-cmds=list-mainporcelain,list-complete,config | + grep ^cherry >actual && + test_cmp expected actual +' + test_expect_success 'setup for integration tests' ' echo content >file1 && echo more >file2 && From patchwork Fri Mar 1 17:34:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Zullinger X-Patchwork-Id: 10835771 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 515EC139A for ; Fri, 1 Mar 2019 17:35:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36DEE2EE4B for ; Fri, 1 Mar 2019 17:35:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29B582EE8A; Fri, 1 Mar 2019 17:35:04 +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 C0BCD2EE4B for ; Fri, 1 Mar 2019 17:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389469AbfCARfC (ORCPT ); Fri, 1 Mar 2019 12:35:02 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:59796 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388333AbfCARfC (ORCPT ); Fri, 1 Mar 2019 12:35:02 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 73A9843199; Fri, 1 Mar 2019 12:35:00 -0500 (EST) (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=cXpqm0cC00kkQCFegZi04HQYN gg=; b=smunXT8pHMmGL1hGKPDW3X/xMdqGgQ+r2Ps+KbQH7Zy5mil9ucMJIQHX6 T4l7fmZkG750TifI5l0qOArkPT0C2ryuLvGeMZLiPoXQtIXAioUOwvpekjFn5/8p LM0rHNr+GrJjaIoxiGgG7fwCySdK27tQ2mYsgO3GiNfKfa2woY= 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=uJikgwJSusKCSR4KR24 4AHdSdgBRuRYbX8dh1A9LvBi307JVMoPI5+4l0qFtBS7zCRdgXZth0PCMHK2t/76 OigXxN2/+IpkZtExsXhEIKO/hFWEBBYgg300ZbrBbwEcIWDn/56BRdtL1mORN0iG 5Vj+EJjLQOExkRU7f2623rnw= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 6C75943198; Fri, 1 Mar 2019 12:35:00 -0500 (EST) (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 8296443192; Fri, 1 Mar 2019 12:34:55 -0500 (EST) (envelope-from tmz@pobox.com) From: Todd Zullinger To: Jeff King Cc: git@vger.kernel.org, =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmfhu41jIER1eQ==?= , =?utf-8?q?SZEDER_G=C3=A1bor?= Subject: [PATCH 3/3] completion: fix multiple command removals Date: Fri, 1 Mar 2019 12:34:43 -0500 Message-Id: <20190301173443.16429-4-tmz@pobox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190228230506.GA20625@sigill.intra.peff.net> References: <20190228230506.GA20625@sigill.intra.peff.net> MIME-Version: 1.0 X-Pobox-Relay-ID: 54C7B55A-3C48-11E9-9168-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 6532f3740b ("completion: allow to customize the completable command list", 2018-05-20) added the completion.commands config variable. The documentation states multiple commands may be added, separated by spaces. Adding multiple commands to remove fails, only removing the last command in the config. Fix multiple command removals. Signed-off-by: Jeff King Reported-by: Todd Zullinger Signed-off-by: Jeff King --- Jeff, The commit message could probably be worded better, particularly since it's forged in your name. 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 dd11bb660d..d7daa1ca92 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' ' echo cherry-pick >expected && test_config_global completion.commands "-cherry -mergetool" && git --list-cmds=list-mainporcelain,list-complete,config |