Skip to content

fix: handle detached HEAD and rebase states#45

Merged
llimllib merged 2 commits intomainfrom
handle-non-branch
Apr 10, 2026
Merged

fix: handle detached HEAD and rebase states#45
llimllib merged 2 commits intomainfrom
handle-non-branch

Conversation

@llimllib
Copy link
Copy Markdown
Owner

Summary

  • Previously git-ls crashed with Failed to get current branch in detached HEAD state
  • Now matches git status output exactly for all HEAD states:
    • On branch X
    • HEAD detached at X (still at detach point)
    • HEAD detached from X (moved since detaching)
    • rebase in progress; onto X / interactive rebase in progress; onto X
    • Not currently on any branch. (fallback)
  • Resolves friendly ref names (tags, branches) before falling back to short hash

Test plan

  • TestHeadDescription/on_branch — normal branch
  • TestHeadDescription/detached_at — detached, HEAD unchanged
  • TestHeadDescription/detached_from — detached, HEAD moved
  • TestHeadDescription/rebase_in_progress — mid-rebase with conflict
  • Full test suite passes

🤖 Generated with Claude Code

llimllib added 2 commits April 9, 2026 12:59
Previously git-ls would crash with "Failed to get current branch" when
not on a branch. Now matches git-status output exactly: "HEAD detached
at/from <ref>", "rebase in progress; onto <ref>", etc.
@llimllib llimllib merged commit cad5a9c into main Apr 10, 2026
1 check passed
@llimllib llimllib deleted the handle-non-branch branch April 10, 2026 03:11
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