-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't error if git tab completion is not available. Fixes #1011 #1016
Conversation
The patch applied in the last bump is incorrect and effectively disables bash completion no matter what order the completions were loaded in as `type -f` will not find `__git_complete`. ``` $ type -f __git_complete bash: type: __git_complete: not found $ type __git_complete | grep 'is a' __git_complete is a function ``` There is a pull-request upstream that properly addresses the issue of `__git_complete` not being found but it's not accepted yet, jonas/tig#1016 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Justin Bronder <jsbronder@gentoo.org>
The patch applied in the last bump is incorrect and effectively disables bash completion no matter what order the completions were loaded in as `type -f` will not find `__git_complete`. ``` $ type -f __git_complete bash: type: __git_complete: not found $ type __git_complete | grep 'is a' __git_complete is a function ``` There is a pull-request upstream that properly addresses the issue of `__git_complete` not being found but it's not accepted yet, jonas/tig#1016 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Justin Bronder <jsbronder@cold-front.org>
Co-authored-by: Ilya A. Kriveshko <iillyyaa@gmail.com>
The patch applied in the last bump is incorrect and effectively disables bash completion no matter what order the completions were loaded in as `type -f` will not find `__git_complete`. ``` $ type -f __git_complete bash: type: __git_complete: not found $ type __git_complete | grep 'is a' __git_complete is a function ``` There is a pull-request upstream that properly addresses the issue of `__git_complete` not being found but it's not accepted yet, jonas/tig#1016 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Justin Bronder <jsbronder@cold-front.org> Closes: #17715 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
The patch applied in the last bump is incorrect and effectively disables bash completion no matter what order the completions were loaded in as `type -f` will not find `__git_complete`. ``` $ type -f __git_complete bash: type: __git_complete: not found $ type __git_complete | grep 'is a' __git_complete is a function ``` There is a pull-request upstream that properly addresses the issue of `__git_complete` not being found but it's not accepted yet, jonas/tig#1016 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Justin Bronder <jsbronder@cold-front.org> Closes: gentoo#17715 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
# variables (like cword and prev) to be defined | ||
__git_complete tig _tig | ||
if [ "$(type -t __git_complete)" = function ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick... if ! declare -f __git_complete &>/dev/null; then
is a better test for existence of function because it doesn't spawn shell with $()
See #1011 (comment). I did some analysis and found that sourcing |
#1055 is an alternate solution that attempts to define |
Yes, the approach in #1055 looks more reasonable to me than just silently doing nothing if the git completion is not loaded yet. |
Cool. I'll go ahead and close. Hopefully someone with write access can merge? |
Seems like tab completion should always be a nice-to have, so made it just exit silently if git tab completions were not available. If you want I can make it print a friendly error message.
As is, users get a pretty mysterious:
And it is a little hard to know where it came from.
Fixes #1011