Skip to content

[codex] Filter origin HEAD from branch picker - #2

Merged
Syati merged 1 commit into
mainfrom
codex/filter-origin-head-branch
Jun 6, 2026
Merged

[codex] Filter origin HEAD from branch picker#2
Syati merged 1 commit into
mainfrom
codex/filter-origin-head-branch

Conversation

@Syati

@Syati Syati commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Filter refs/remotes/origin/HEAD before normalizing branch names in the branch picker.
  • Add a regression test that ensures origin is not shown as a selectable branch.

Root cause

git for-each-ref --format='%(refname:short)' can shorten refs/remotes/origin/HEAD to origin, so the previous origin/HEAD filter did not catch it.

Validation

  • zsh test/run.zsh

Entire-Checkpoint: 64cb42e92c33
@Syati
Syati marked this pull request as ready for review June 6, 2026 23:11
Copilot AI review requested due to automatic review settings June 6, 2026 23:11
@Syati
Syati merged commit f9ef47d into main Jun 6, 2026
1 check passed
@Syati
Syati deleted the codex/filter-origin-head-branch branch June 6, 2026 23:11

Copilot AI 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.

Pull request overview

This PR fixes a branch-picker edge case where the remote symbolic ref refs/remotes/origin/HEAD could be shortened by Git to origin, causing it to appear as a selectable “branch”. The fix filters the origin/HEAD ref before normalizing names, and adds a regression test to prevent reintroduction.

Changes:

  • Switch git for-each-ref output to full refnames (%(refname)) and normalize via sed after filtering refs/remotes/origin/HEAD.
  • Add a regression test that creates refs/remotes/origin/HEAD and asserts origin is not shown as a selectable entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
entire-fzf.plugin.zsh Filters refs/remotes/origin/HEAD prior to name normalization to avoid the origin entry leak.
test/branch_filter_test.zsh Adds coverage to ensure origin/HEAD does not surface as origin in the branch picker output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants