Description
git gtr completion bash fails after installing via Homebrew:
$ source <(git gtr completion bash)
cat: /opt/homebrew/Cellar/git-gtr/2.4.0/completions/gtr.bash: No such file or directory
Root Cause
The completion.sh command hardcodes the path $GTR_DIR/completions/gtr.bash (source), but the Homebrew formula installs the completion file to Homebrew's conventional location:
etc/bash_completion.d/git-gtr
So the file exists but at a different path than what the command expects:
Expected by completion.sh |
Actual Homebrew location |
$GTR_DIR/completions/gtr.bash |
$(brew --prefix git-gtr)/etc/bash_completion.d/git-gtr |
The same issue likely affects Fish completions ($GTR_DIR/completions/git-gtr.fish).
Workaround
Source the file directly instead of using the completion subcommand:
source "$(brew --prefix git-gtr)/etc/bash_completion.d/git-gtr"
Suggested Fix
Either:
- Have the Homebrew formula preserve the
completions/ directory alongside the etc/bash_completion.d/ layout, or
- Update
completion.sh to check multiple paths (e.g., fall back to $GTR_DIR/etc/bash_completion.d/git-gtr when installed via Homebrew)
Environment
- macOS (Apple Silicon)
- Installed via:
brew install git-gtr
- Version: 2.4.0
Description
git gtr completion bashfails after installing via Homebrew:Root Cause
The
completion.shcommand hardcodes the path$GTR_DIR/completions/gtr.bash(source), but the Homebrew formula installs the completion file to Homebrew's conventional location:So the file exists but at a different path than what the command expects:
completion.sh$GTR_DIR/completions/gtr.bash$(brew --prefix git-gtr)/etc/bash_completion.d/git-gtrThe same issue likely affects Fish completions (
$GTR_DIR/completions/git-gtr.fish).Workaround
Source the file directly instead of using the
completionsubcommand:Suggested Fix
Either:
completions/directory alongside theetc/bash_completion.d/layout, orcompletion.shto check multiple paths (e.g., fall back to$GTR_DIR/etc/bash_completion.d/git-gtrwhen installed via Homebrew)Environment
brew install git-gtr