summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-03-24 20:35:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-25 16:34:34 (GMT)
commit9f642a71699dd10770dcf0e66d581b53ef244b14 (patch)
treeba00051997219c5355aa216f575947aa41ddd9db /t/t9902-completion.sh
parent48e1c69ade27395dfe7eb2be8aadf5fc50576a21 (diff)
downloadgit-9f642a71699dd10770dcf0e66d581b53ef244b14.zip
git-9f642a71699dd10770dcf0e66d581b53ef244b14.tar.gz
git-9f642a71699dd10770dcf0e66d581b53ef244b14.tar.bz2
completion: add --option completion for most builtin commands
Many builtin commands use parseopt which can expose the option list via --git-completion-helper but do not have explicit support in git-completion.bash. This patch detects those commands and uses __gitcomp_builtin for option completion. This does not pollute the command name completion though. "git <tab>" will show you the same set as before. This only kicks in when you type the correct command name. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index b7f5b1e..1b34caa 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1454,6 +1454,12 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c
EOF
'
+test_expect_success 'completion without explicit _git_xxx function' '
+ test_completion "git version --" <<-\EOF
+ --build-options Z
+ EOF
+'
+
test_expect_failure 'complete with tilde expansion' '
git init tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&