Errors from zsh in git function from `/usr/share/zsh/site-functions/_git` when using tab completion in a git directory - if bash is the login shell
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 141
- Forks
- 146
- Avg merge
- 11h 7m
- Merged PRs (30d)
- 407
Description
Please confirm there isn't an open report for this issue
- I have searched through bug reports
Summary
On a system where the login shell is bash, if I switch to zsh, completion in a git directory causes errors. Note that we have sometimes instructed users to use bash as the login shell to workaround problems at login.
Whenever I'm in a 'git' repo directory, run a command, and use Tab to complete, I get the following error (the command is git switch and everything after that is the error text):
$ git switch usingWelcome!
_git:.:48: no such file or directory:
/usr/share/zsh/site-functions/git-completion.bash
__git_zsh_bash_func:8: command not found: __git_aliased_command
__git_zsh_bash_func:8: command not found: __git_aliased_command
__git_zsh_bash_func:8: command not found: __git_aliased_command
This makes tab completion in zsh pretty unusable unless the login shell is zsh
Steps to reproduce
- In terminal, be in a git directory like
$HOME/solus-packages/packages - Run a partial command like
git switchand press Tab
Expected result
Tab completion is successful
Actual result
Tab completion works, but there is the error output
Environment
- Is system up to date?
Repo
Unstable
Desktop Environment
Plasma
System details
Operating System: Solus 4.7
KDE Plasma Version: 6.5.2
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.3
Kernel Version: 6.16.12-323.current (64-bit)
Graphics Platform: Wayland
Processors: 16 × 11th Gen Intel® Core™ i7-11800H @ 2.30GHz
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® UHD Graphics
Graphics Processor 2: NVIDIA GeForce RTX 3060 Laptop GPU
eopkg info zsh
Installed package:
Name : zsh, version: 5.9, release: 36
Other comments
The function is in /usr/share/zsh/site-functions/_git
According to the pspec_x86_64.xml file we do install the bash completions here
/usr/share/zsh/functions/_bash_completions
The file the function is looking for is here
/usr/share/zsh/site-functions/git-completion.bash
This happens on only one of the two laptops I have running unstable. They both have zsh installed but the error occurs on the system where bash is the login shell and I switch to zsh in the terminal. On the system where zsh is the login shell, completions work as expected.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with /usr/share/zsh/site-functions/_git and compare its referenced git-completion.bash path with /usr/share/zsh/functions/_bash_completions and the package spec mentioned in the report. Reproduce after switching from a bash login shell to zsh in a Git directory, then verify that tab completion produces no error output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, git, zsh
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100