summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-01-15 15:20:29 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-01-15 15:20:30 -0800
commitf9fb9063fd792e3f50ae2cd0847c88d2df287068 (patch)
tree30890fbcdb81542309e29383230e223dd42c249d /t
parentMerge branch 'en/stash-apply-sparse-checkout' (diff)
parentcompletion: add proper public __git_complete (diff)
downloadtgif-f9fb9063fd792e3f50ae2cd0847c88d2df287068.tar.xz
Merge branch 'fc/completion-aliases-support'
Bash completion (in contrib/) update to make it easier for end-users to add completion for their custom "git" subcommands. * fc/completion-aliases-support: completion: add proper public __git_complete test: completion: add tests for __git_complete completion: bash: improve function detection completion: bash: add __git_have_func helper
Diffstat (limited to 't')
-rwxr-xr-xt/t9902-completion.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index a1c4f1f6d4..c4a7758409 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2380,4 +2380,24 @@ test_expect_success 'sourcing the completion script clears cached --options' '
verbose test -z "$__gitcomp_builtin_notes_edit"
'
+test_expect_success '__git_complete' '
+ unset -f __git_wrap__git_main &&
+
+ __git_complete foo __git_main &&
+ __git_have_func __git_wrap__git_main &&
+ unset -f __git_wrap__git_main &&
+
+ __git_complete gf _git_fetch &&
+ __git_have_func __git_wrap_git_fetch &&
+
+ __git_complete foo git &&
+ __git_have_func __git_wrap__git_main &&
+ unset -f __git_wrap__git_main &&
+
+ __git_complete gd git_diff &&
+ __git_have_func __git_wrap_git_diff &&
+
+ test_must_fail __git_complete ga missing
+'
+
test_done