summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-12-30 23:29:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-04 23:25:56 (GMT)
commit5a067ba9d04eebc92ad77f101b785219238f4f1e (patch)
tree5c8dd921b4344c06c65e824d180dc98186938880 /t/t9902-completion.sh
parent0e02bdc17a4d4beca06d5606a1d3020c79676d7f (diff)
downloadgit-5a067ba9d04eebc92ad77f101b785219238f4f1e.zip
git-5a067ba9d04eebc92ad77f101b785219238f4f1e.tar.gz
git-5a067ba9d04eebc92ad77f101b785219238f4f1e.tar.bz2
completion: add proper public __git_complete
When __git_complete was introduced, it was meant to be temporarily, while a proper guideline for public shell functions was established (tentatively _GIT_complete), but since that never happened, people in the wild started to use __git_complete, even though it was marked as not public. Eight years is more than enough wait, let's mark this function as public, and make it a bit more user-friendly. So that instead of doing: __git_complete gk __gitk_main The user can do: __git_complete gk gitk And instead of: __git_complete gf _git_fetch Do: __git_complete gf git_fetch Backwards compatibility is maintained. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index c0b4380..c4a7758 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2382,10 +2382,22 @@ test_expect_success 'sourcing the completion script clears cached --options' '
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_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