git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 2/2] checkout: learn to respect checkout.guess
Date: Tue, 6 Oct 2020 01:07:30 -0700	[thread overview]
Message-ID: <20201006080730.GA2419589@generichostname> (raw)
In-Reply-To: <xmqqwo057ul5.fsf@gitster.c.googlers.com>

Hi Junio,

On Sun, Oct 04, 2020 at 10:46:14AM -0700, Junio C Hamano wrote:
> Denton Liu <liu.denton@gmail.com> writes:
> 
> > The current behavior of git checkout/switch is that --guess is currently
> > enabled by default. However, some users may not wish for this to happen
> > automatically. Instead of forcing users to specify --no-guess manually
> > each time, teach these commands the checkout.guess configuration
> > variable that gives users the option to set a default behavior.
> >
> > Teach the completion script to recognize the new config variable and
> > disable DWIM logic if it is set to false.
> >
> > Signed-off-by: Denton Liu <liu.denton@gmail.com>
> > ---
> 
> Asking for input from Dscho on how to futureproof the tests along
> the same line as js/default-branch-name-part-2 topic.

Perhaps we could extract lists that are repeated often into common files
so that they only need to be changed in one place? Something like this:

-- >8 --
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 7b7bc6e4bd..86da44231d 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1240,8 +1240,8 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' '
 	test_cmp expected out
 '
 
-test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
-	test_completion "git switch " <<-\EOF
+test_expect_success 'prepare expect files for DWIM tests' '
+	cat >local-and-unique-remote <<-\EOF &&
 	branch-in-other Z
 	master Z
 	master-in-other Z
@@ -1249,6 +1249,10 @@ test_expect_success 'git switch - with no options, complete local branches and u
 	EOF
 '
 
+test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
+	test_completion "git switch " <local-and-unique-remote
+'
+
 test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' '
 	test_completion "git checkout " <<-\EOF
 	HEAD Z

  reply	other threads:[~2020-10-06  8:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 11:18 [PATCH 0/2] checkout: learn the checkout.guess config variable Denton Liu
2020-10-04 11:18 ` [PATCH 1/2] Documentation/config/checkout: replace sq with backticks Denton Liu
2020-10-04 11:18 ` [PATCH 2/2] checkout: learn to respect checkout.guess Denton Liu
2020-10-04 17:46   ` Junio C Hamano
2020-10-06  8:07     ` Denton Liu [this message]
2020-10-06 18:41       ` Junio C Hamano
2020-10-06 19:31         ` Johannes Schindelin
2020-10-07  5:09 ` [PATCH v2 0/2] checkout: learn the checkout.guess config variable Denton Liu
2020-10-07  5:09   ` [PATCH v2 1/2] Documentation/config/checkout: replace sq with backticks Denton Liu
2020-10-07  5:09   ` [PATCH v2 2/2] checkout: learn to respect checkout.guess Denton Liu
2020-10-07 16:47     ` Junio C Hamano
2020-10-08  5:48   ` [PATCH v3 0/2] checkout: learn the checkout.guess config variable Denton Liu
2020-10-08  5:48     ` [PATCH v3 1/2] Documentation/config/checkout: replace sq with backticks Denton Liu
2020-10-08  5:48     ` [PATCH v3 2/2] checkout: learn to respect checkout.guess Denton Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201006080730.GA2419589@generichostname \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).