Skip to content

fix: git rom default-branch fallback and Docker completion registration - #39

Merged
chetmancini merged 1 commit into
masterfrom
chetmancini/git-rom-default-branch-fallback
Jun 2, 2026
Merged

fix: git rom default-branch fallback and Docker completion registration#39
chetmancini merged 1 commit into
masterfrom
chetmancini/git-rom-default-branch-fallback

Conversation

@chetmancini

Copy link
Copy Markdown
Owner

Fixes two bugs surfaced in review.

The git rom alias attached its || echo main fallback to the sed stage, which exits 0 on empty input, so a repo without refs/remotes/origin/HEAD produced git rebase origin/ (fatal: invalid upstream 'origin/'); it's now an inline function mirroring the zsh _git_default_branch chain (origin/HEAD → origin/main → origin/master → main), verified live against a repo with origin/HEAD unset.

Docker shell completions were appended to fpath after the single cached compinit and never registered, so the Docker completion dir now sits before compinit alongside the Grok one.

To verify: git config -f .gitconfig alias.rom parses, and git rom resolves the right upstream even when origin/HEAD is missing; new shells pick up ~/.docker/completions.

🤖 Generated with Claude Code

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>
@chetmancini
chetmancini merged commit b2ad02a into master Jun 2, 2026
4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread .zshrc
# 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant