Merge branch 'rh/complete-symbolic-ref'

Command line completion script (in contrib/) learned to complete
"git symbolic-ref" a bit better (you need to enable plumbing
commands to be completed with GIT_COMPLETION_SHOW_ALL_COMMANDS).

* rh/complete-symbolic-ref:
  completion: add docs on how to add subcommand completions
  completion: improve docs for using __git_complete
  completion: add 'symbolic-ref'
This commit is contained in:
Junio C Hamano
2024-05-08 10:18:45 -07:00
2 changed files with 51 additions and 3 deletions

View File

@ -2518,6 +2518,29 @@ test_expect_success 'complete tree filename with metacharacters' '
EOF
'
test_expect_success 'symbolic-ref completes builtin options' '
test_completion "git symbolic-ref --d" <<-\EOF
--delete Z
EOF
'
test_expect_success 'symbolic-ref completes short ref names' '
test_completion "git symbolic-ref foo m" <<-\EOF
main Z
mybranch Z
mytag Z
EOF
'
test_expect_success 'symbolic-ref completes full ref names' '
test_completion "git symbolic-ref foo refs/" <<-\EOF
refs/heads/main Z
refs/heads/mybranch Z
refs/tags/mytag Z
refs/tags/A Z
EOF
'
test_expect_success PERL 'send-email' '
test_completion "git send-email --cov" <<-\EOF &&
--cover-from-description=Z