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