-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
bash completion incompatibility with git 2.30.0 #2684
Comments
Same experience here. I haven't checked the history of Git's completion script in the distribution, but it looks like—among other things—a wrapper function name changed from Here's a fix that works for me,
--- /usr/local/Cellar/hub/2.14.2/etc/bash_completion.d/hub.bash_completion.sh.orig 2021-01-05 21:11:04.000000000 +0700
+++ /usr/local/Cellar/hub/2.14.2/etc/bash_completion.d/hub.bash_completion.sh 2021-01-05 21:12:39.000000000 +0700
@@ -2,12 +2,12 @@
# This script complements the completion script that ships with git.
# If there is no git tab completion, but we have the _completion loader try to load it
-if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
+if ! declare -F __git > /dev/null && declare -F _completion_loader > /dev/null; then
_completion_loader git
fi
# Check that git tab completion is available and we haven't already set up completion
-if declare -F _git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then
+if declare -F __git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then
# Duplicate and rename the 'list_all_commands' function
eval "$(declare -f __git_list_all_commands | \
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
@@ -382,6 +382,5 @@
}
# Enable completion for hub even when not using the alias
- complete -o bashdefault -o default -o nospace -F _git hub 2>/dev/null \
- || complete -o default -o nospace -F _git hub
+ __git_complete hub __git_main
fi Sharing here before I submit a PR because I'm not sure this is the "right way" to fix it going forward (and backward…), in particular the
|
Seeing same issue. Dunno if relevant, but there was recently a bash update as well. |
Yeah, looks like @ches I think your fix looks right to me. |
@ches Thanks for diving into this! Your diff looks good and you are welcome to submit it as a PR. Any chance that you can make it backwards-compatible, meaning that if |
Having the same issue, uninstalled |
completion from git package:
completion from hub package
|
FYI: |
Hub break git completions, see mislav/hub#2684
Also it seems |
This eliminates some cruft for supporting bash_completion v1, which is really unnecessary at this point. Even servers used within all infrastructure I manage are modern and support v2, like CentOS 7. Note that this work was done in response to debugging why git completions were not working. In the end, it had to do with the installation of GitHub's hub utility: mislav/hub#2684. Ultimatelty, hub was removed until that is fixed.
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Hub break git completions, see mislav/hub#2684
Until the bash completion issue is fixed mislav/hub#2684
Thanks for writing this up.
I noticed that https://github.com/scop/bash-completion introduces a few nuances to the problem: eval $(/opt/homebrew/bin/brew shellenv)
. /opt/homebrew/etc/bash_completion.d/git-completion.bash
. /opt/homebrew/etc/bash_completion.d/hub.bash_completion.sh
complete | grep '\bgit\b'
# => complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git eval $(/opt/homebrew/bin/brew shellenv)
. "/opt/homebrew/etc/profile.d/bash_completion.sh"
complete | grep '\bgit\b'
# => complete -F _minimal git |
This is not a full solution AFAICT since internally git now depends on |
I don't think |
Hub break git completions, see mislav/hub#2684
Command attempted:
Bash completion doesn't trigger for
git
andhub
commands (e.g.git p<tab><tab>
doesn't suggest git subcommands but rather attempts a more general bash file/path completion)What happened:
With
git
got upgraded yesterday from2.29.0
to2.30.0
viabrew
bash completion within new shell invocation doesn't work anymore.More info:
hub
version2.14.2
, OS:macOS Catalina 10.15.6
Deinstalling
hub
fixes the issue. There were no issues withgit
of2.29.0
version.I'm trying to figure out whether it's only me or someone else is experiencing such issue too as turning off bash completion scripts sourcing and sourcing manually
/usr/local/etc/bash_completion.d/git-completion.bash
and then/usr/local/etc/bash_completion.d/hub.bash_completion.sh
makes bash completion work as expected 😕The text was updated successfully, but these errors were encountered: