aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-14 14:05:25 -0700
committerJunio C Hamano <gitster@pobox.com>2024-03-14 14:05:25 -0700
commitc5a7ee124d491d5fe0e3948532ca8219b3b471c0 (patch)
treea30b071b6cddc7f18243bcb8b25fb5a508d22d69 /t
parent43100746e69aacb3f8110a9855aacd66483f7e24 (diff)
parent3574816d98a332187fc331826cdf170b0adf3a47 (diff)
downloadgit-c5a7ee124d491d5fe0e3948532ca8219b3b471c0.tar.gz
Merge branch 'rj/complete-worktree-paths-fix'
The logic to complete the command line arguments to "git worktree" subcommand (in contrib/) has been updated to correctly honor things like "git -C dir" etc. * rj/complete-worktree-paths-fix: completion: fix __git_complete_worktree_paths
Diffstat (limited to 't')
-rwxr-xr-xt/t9902-completion.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 867b5e61da..569cf23104 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1263,6 +1263,29 @@ test_expect_success '__git_complete_fetch_refspecs - fully qualified & prefix' '
test_cmp expected out
'
+test_expect_success '__git_complete_worktree_paths' '
+ test_when_finished "git worktree remove other_wt" &&
+ git worktree add --orphan other_wt &&
+ run_completion "git worktree remove " &&
+ grep other_wt out
+'
+
+test_expect_success '__git_complete_worktree_paths - not a git repository' '
+ (
+ cd non-repo &&
+ GIT_CEILING_DIRECTORIES="$ROOT" &&
+ export GIT_CEILING_DIRECTORIES &&
+ test_completion "git worktree remove " ""
+ )
+'
+
+test_expect_success '__git_complete_worktree_paths with -C' '
+ test_when_finished "git -C otherrepo worktree remove otherrepo_wt" &&
+ git -C otherrepo worktree add --orphan otherrepo_wt &&
+ run_completion "git -C otherrepo worktree remove " &&
+ grep otherrepo_wt 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
branch-in-other Z