fix: git rom default-branch fallback and Docker completion registration - #39
Conversation
The git rom alias attached its || echo main fallback to the sed stage, which exits 0 on empty input, so a missing refs/remotes/origin/HEAD produced 'git rebase origin/' (fatal: invalid upstream). Rewrite it as an inline function mirroring the zsh _git_default_branch chain (origin/HEAD -> origin/main -> origin/master -> main). Docker completions were appended to fpath after the single cached compinit and never registered. Move the Docker fpath entry before compinit alongside the Grok completion dir. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b6a21cfc8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Completion dirs must be on fpath before compinit so they're picked up by the | ||
| # single cached compinit below (installer blocks at the bottom only set fpath). | ||
| [ -d ~/.grok/completions/zsh ] && fpath=(~/.grok/completions/zsh $fpath) | ||
| [ -d ~/.docker/completions ] && fpath=(~/.docker/completions $fpath) |
There was a problem hiding this comment.
Rebuild compdump when adding Docker completions
When ~/.zcompdump is newer than 24 hours, the block below still runs compinit -C; the zsh compinit manual says -C omits the check for new completion functions, so users whose existing dump was created before Docker was on fpath will continue to miss _docker until the dump ages out or is deleted. Since this line is intended to make new shells pick up ~/.docker/completions, also force a non--C compinit or invalidate the dump when this directory is newly added.
Useful? React with 👍 / 👎.
Fixes two bugs surfaced in review.
The
git romalias attached its|| echo mainfallback to thesedstage, which exits 0 on empty input, so a repo withoutrefs/remotes/origin/HEADproducedgit rebase origin/(fatal: invalid upstream 'origin/'); it's now an inline function mirroring the zsh_git_default_branchchain (origin/HEAD → origin/main → origin/master → main), verified live against a repo withorigin/HEADunset.Docker shell completions were appended to
fpathafter the single cachedcompinitand never registered, so the Docker completion dir now sits beforecompinitalongside the Grok one.To verify:
git config -f .gitconfig alias.romparses, andgit romresolves the right upstream even whenorigin/HEADis missing; new shells pick up~/.docker/completions.🤖 Generated with Claude Code