From patchwork Sat Apr 25 02:20:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8572617EA for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F0E120857 for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 Received: from mga12.intel.com ([192.55.52.136]:47707 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 IronPort-SDR: hMuJH0UCOLml9ZVhlPvXSmUtUQK1VwdRp83+A+fAQo6IQk5WiXsJXz0VSThVlXWiiRAGQl5gvS APUodEbUuZjg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:52 -0700 IronPort-SDR: /FzbEKvcbnzFO0sWcLc1bHzMxWvFg5X+u0grwwzq/uoNY0EW41S5f/Nz+vGCzILvmiPOzJKDIP UhoNxnx6p55A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056776" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:52 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 01/11] completion: add some simple test cases for git switch completion Date: Fri, 24 Apr 2020 19:20:34 -0700 Message-Id: <20200425022045.1089291-2-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller Future work is going to refactor the completion support for git switch, so add some new test cases in order to help prevent regressions. Signed-off-by: Jacob Keller --- t/t9902-completion.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 5505e5aa249e..03e8188f023d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1240,6 +1240,31 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' ' test_cmp expected out ' +test_expect_success 'git switch - with --no-guess, complete only local branches' ' + test_completion "git switch --no-guess " <<-\EOF + master Z + matching-branch Z + EOF +' + +test_expect_success 'git switch - with --detach, complete all references' ' + test_completion "git switch --detach " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +test_expect_success 'git switch - with --no-track, complete only local branch names' ' + test_completion "git switch --no-track " <<-\EOF + master Z + matching-branch Z + EOF +' + test_expect_success 'teardown after ref completion' ' git branch -d matching-branch && git tag -d matching-tag && From patchwork Sat Apr 25 02:20:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A171915AB for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AE7D20857 for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726145AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 Received: from mga12.intel.com ([192.55.52.136]:47707 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 IronPort-SDR: kDVruJHFDa5acvEEIXNDNmloLnKSgeY/SDOo09lYdO+5cPXtY5e4NJGUsAwo4hNNvHDZyZplXL Tk1MSYWtbIxg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:52 -0700 IronPort-SDR: CQQr97qCb4uYnPgFDJ4ApMMVLsg5uHjfbXSr+csnStO2QsfZOaXdK96nwni6k2nAP8Qhjn1Fmu tHzBhi7K9W3A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056777" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:52 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 02/11] completion: add test showing subpar git switch completion Date: Fri, 24 Apr 2020 19:20:35 -0700 Message-Id: <20200425022045.1089291-3-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller With no options, git switch only allows switching branches or DWIM to create a local branch tracking a remote branch of the same name. However, tab completion will expand "git switch " to any local reference, including pseudorefs like HEAD, or tags. Add a test case which highlights this failure, which will be fixed in a future refactoring of git switch completion support. Signed-off-by: Jacob Keller --- t/t9902-completion.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 03e8188f023d..af4661cbcc73 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1240,6 +1240,19 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' ' test_cmp expected out ' +# TODO: git switch by default should only include local branches and anything which +# would be understood by the DWIM logic. Currently it will complete most +# references including pseudorefs like HEAD and FETCH_HEAD, as well as tags. +# These should not be completed unless certain options have been enabled. +test_expect_failure 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' ' + test_completion "git switch " <<-\EOF + branch-in-other Z + master Z + master-in-other Z + matching-branch Z + EOF +' + test_expect_success 'git switch - with --no-guess, complete only local branches' ' test_completion "git switch --no-guess " <<-\EOF master Z From patchwork Sat Apr 25 02:20:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2D2C1892 for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A65B12084D for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726154AbgDYCU4 (ORCPT ); Fri, 24 Apr 2020 22:20:56 -0400 Received: from mga12.intel.com ([192.55.52.136]:47708 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 IronPort-SDR: U69Mv9GXItUuPd/HV6VupBxGPkQ4BKyfIX/TSto9SKcsq3Hv5iLNKjJt9QxV7e7XkNTXBz5rSi cqB1LTkOqCSg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:52 -0700 IronPort-SDR: SKm+yE7Qxc5Bc1SMUtTb6bZrP7vOETsdH0Sdlw6q96ZVwCyY0X5cLV9aR1aIJjUaQyOl12mhdR Ufz+rdPkKzjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056778" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:52 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 03/11] completion: add test highlighting subpar git switch --track completion Date: Fri, 24 Apr 2020 19:20:36 -0700 Message-Id: <20200425022045.1089291-4-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller If git switch is called with --track, it will attempts to DWIM into creating a local tracking branch that tracks the provided remote branch. It seems reasonable that, to support this behavior, we should only complete remote branches in the form "/". Indeed, current completion is not just sub-par, but could almost be described as entirely useless. $git switch --track will only report *local* branch names. Indeed a new test case highlights this quite well: --- expected 2020-04-25 00:25:34.424965326 +0000 +++ out_sorted 2020-04-25 00:25:34.441965370 +0000 @@ -1,2 +1,2 @@ -other/branch-in-other -other/master-in-other +master +matching-branch not ok 100 - git switch - with --track, complete only remote branches # TODO known breakage Understanding exactly what causes this is not that simple. First we enable DWIM output by default. Then, if "--track", "--no-track", or "--no-guess" is enabled on the command line, we disable DWIM. This makes sense, because --track should not include the default "DWIM" remote branch names. Following this, there is a check for "--detach". If "--detach" is *not* present, then we set only_local_ref=y. this is done because we would like to avoid printing remote references. This immediately seems wrong because --track should allow completing remote references. Finally, if only_local_ref is 'y', and the track_opt for DWIM logic is disabled, we complete only local branches. This occurs because --track disabled track_opt, and not providing --detach sets only_local_ref to 'y'. Fixing this correctly is not trivial, so it is left to a follow up change. Signed-off-by: Jacob Keller --- t/t9902-completion.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index af4661cbcc73..002223160058 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1271,6 +1271,16 @@ test_expect_success 'git switch - with --detach, complete all references' ' EOF ' +# TODO: Since --track on its own will perform a DWIM to extract the local +# branch name, we should complete only the remote branches with their remote +# name. +test_expect_failure 'git switch - with --track, complete only remote branches' ' + test_completion "git switch --track " <<-\EOF + other/branch-in-other Z + other/master-in-other Z + EOF +' + test_expect_success 'git switch - with --no-track, complete only local branch names' ' test_completion "git switch --no-track " <<-\EOF master Z From patchwork Sat Apr 25 02:20:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C79241805 for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7EB920857 for ; Sat, 25 Apr 2020 02:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726177AbgDYCU4 (ORCPT ); Fri, 24 Apr 2020 22:20:56 -0400 Received: from mga12.intel.com ([192.55.52.136]:47707 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbgDYCUx (ORCPT ); Fri, 24 Apr 2020 22:20:53 -0400 IronPort-SDR: 7RtlZlLDB9SObqxHkSLADdHEFqH1kg/dLsFLfNBXoeMy1VuAHJXUigrnnozsvfURqtheB/lzkz vnw5TZ5ZCRLw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:52 -0700 IronPort-SDR: POMDv5k+oKbtlFf1ui/NlReo7+6ZaBh8nl/NGF8szHtwM5bK41kRS7oWW1BU/fUDVHsOCvoLJ8 96qgA6yrj+DQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056779" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:52 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 04/11] completion: add tests showing lack of support for git switch -c/-C Date: Fri, 24 Apr 2020 19:20:37 -0700 Message-Id: <20200425022045.1089291-5-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller Add several tests for git switch completion which highlight the expected behavior if -c or -C have been provided. Show that properly recognizing and supporting -c should override the behavior for --track. Signed-off-by: Jacob Keller --- t/t9902-completion.sh | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 002223160058..a134a8791076 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1288,6 +1288,69 @@ test_expect_success 'git switch - with --no-track, complete only local branch na EOF ' +# TODO: git switch completion does not yet support checking for -c, but it +# should be able to complete all possible references. Based on a quick +# examination of the switch/checkout code, -c will disable DWIM logic and thus +# we should not complete unique remote branch names with -c or -C either. +test_expect_failure 'git switch - with -c, complete all references' ' + test_completion "git switch -c new-branch " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +test_expect_failure 'git switch - with -c, complete all references' ' + test_completion "git switch -C new-branch " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +# TODO: ensure that the completion rules for -c override --track +test_expect_failure 'git switch - with -c and --track, complete all references' ' + test_completion "git switch -c new-branch --track " <<-EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +# TODO: git switch with -c and --no-track should allow creating a branch using +# any reference as a starting point. Because completion support does not +# recognize -c or -C, this doesn't work yet. +test_expect_failure 'git switch - with -c and --no-track, complete all references' ' + test_completion "git switch -c new-branch --no-track " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + +test_expect_failure 'git switch - with -C and --no-track, complete all references' ' + test_completion "git switch -C new-branch --no-track " <<-\EOF + HEAD Z + master Z + matching-branch Z + matching-tag Z + other/branch-in-other Z + other/master-in-other Z + EOF +' + test_expect_success 'teardown after ref completion' ' git branch -d matching-branch && git tag -d matching-tag && From patchwork Sat Apr 25 02:20:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509619 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DF0F15AB for ; Sat, 25 Apr 2020 02:21:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15E6920857 for ; Sat, 25 Apr 2020 02:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbgDYCVF (ORCPT ); Fri, 24 Apr 2020 22:21:05 -0400 Received: from mga12.intel.com ([192.55.52.136]:47708 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgDYCUz (ORCPT ); Fri, 24 Apr 2020 22:20:55 -0400 IronPort-SDR: f2f+VHRdIL3u9uAfavhSSKs9OvzJKbiO/AualTEGd6KgE/7KPbKFF1BXjzmTUENFW/Q+VrZ0yj e0Aidgv/7tyg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:53 -0700 IronPort-SDR: OjD57f2Ny25n3HhEkO+Bif/PDGqtHNm5WWZV9fA8OC6HKLhl2ba53KQqjlJBnXO8VrXECx8Ozu cWo3t57vquoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056781" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:52 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 05/11] completion: remove completion for git switch --orphan Date: Fri, 24 Apr 2020 19:20:39 -0700 Message-Id: <20200425022045.1089291-7-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller git switch with the --orphan option is used to create a new branch that is not connected to any history and is instead based on the empty tree. It does not make sense for completion to return anything in this case, because there is nothing to complete. Check for --orphan, and if it's found, immediately return from _git_switch() without completing anything. Add a test case which documents this expected behavior. Signed-off-by: Jacob Keller --- contrib/completion/git-completion.bash | 11 ++++++++++- t/t9902-completion.sh | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c21786f2fd00..08d3406cf3e4 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2223,9 +2223,18 @@ _git_switch () __gitcomp_builtin switch ;; *) + local track_opt="--track" only_local_ref=n + + # --orphan is used to create a branch disconnected from the + # current history, based on the empty tree. Since the only + # option required is the branch name, it doesn't make sense to + # complete anything here. + if [ -n "$(__git_find_on_cmdline "--orphan")" ]; then + return + fi + # check if --track, --no-track, or --no-guess was specified # if so, disable DWIM mode - local track_opt="--track" only_local_ref=n if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] || [ -n "$(__git_find_on_cmdline "--track --no-track --no-guess")" ]; then track_opt='' diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index a134a8791076..9d02de167219 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1351,6 +1351,13 @@ test_expect_failure 'git switch - with -C and --no-track, complete all reference EOF ' +# TODO: completion does not yet recognize --orphan +test_expect_failure 'git switch - with --orphan, do not complete anything' ' + test_completion "git switch --orphan " <<-\EOF + + EOF +' + test_expect_success 'teardown after ref completion' ' git branch -d matching-branch && git tag -d matching-tag && From patchwork Sat Apr 25 02:20:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 11509617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D78815AB for ; Sat, 25 Apr 2020 02:21:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D9D520857 for ; Sat, 25 Apr 2020 02:21:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726201AbgDYCVE (ORCPT ); Fri, 24 Apr 2020 22:21:04 -0400 Received: from mga12.intel.com ([192.55.52.136]:47710 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgDYCUz (ORCPT ); Fri, 24 Apr 2020 22:20:55 -0400 IronPort-SDR: Fc64hngB+75q7ZCNpsEhepqueYbabjFnbT+T/eUJ3rWqcqUw+KO59r/WiC8v2ZJ8bRCpzaLgxe w10U9NazzDkw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 19:20:53 -0700 IronPort-SDR: Y6Yi3Xr9q57IqYAX9ZgWL64u04XYb1KkVYrlRIxg4vrPijhXlQZe3c3f9Rxr6P8XIbPjJqrMoT h5kKYM+Kj+lA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,314,1583222400"; d="scan'208";a="281056783" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.33]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2020 19:20:53 -0700 From: Jacob Keller To: git@vger.kernel.org Cc: Jonathan Nieder , Jacob Keller Subject: [PATCH 06/11] completion: rename --track option of __git_complete_refs Date: Fri, 24 Apr 2020 19:20:40 -0700 Message-Id: <20200425022045.1089291-8-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200425022045.1089291-1-jacob.e.keller@intel.com> References: <20200425022045.1089291-1-jacob.e.keller@intel.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jacob Keller The __git_complete_refs uses the "--track" option to specify when to enable listing of unique remote branches which could be used by the DWIMery of git checkout and git switch. This is confusing, because both git checkout and git switch have a --track option. This makes looking at the completion code for these two functions confusing. Rename this parameter to --dwim. Because it is plausible for users to have developed their own completions which rely on __git_complete_ref, keep --track as a synonym for --dwim, but do not use it in our own completion code. This reduces the confusion when seeing --track in the _git_switch() and _git_checkout() completion functions. Signed-off-by: Jacob Keller --- contrib/completion/git-completion.bash | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 08d3406cf3e4..02dc1203559c 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -749,7 +749,7 @@ __git_refs () # Usage: __git_complete_refs [