Re: [PATCH 2/2] checkout: learn to respect checkout.guess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Sun, Oct 04, 2020 at 10:46:14AM -0700, Junio C Hamano wrote:
> Denton Liu <liu.denton@xxxxxxxxx> 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@xxxxxxxxx>
> > ---
> 
> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux