Git status should handle detached HEAD by showing the current commit
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- git, typescript
Research direction
Start in apps/kimi-code/src/utils/git/git-status.ts, focusing on getBranchName() and the path that returns null for an empty branch name. Check the existing git status commands, then verify that a detached checkout displays a detached label with the short commit while normal branch status remains unchanged.
Written by the indexing model from the issue text.
Description
Summary
Kimi Code appears to skip git status information when the current repository is in detached HEAD state.
The git status helper reads the branch name with:
git branch --show-current
In a detached checkout, that command returns an empty string. The current code treats an empty branch name as no status and returns null, so the footer/status UI can lose useful repository context even though the worktree is still a valid git repository.
Why this happens
apps/kimi-code/src/utils/git/git-status.ts returns null when getBranchName() is empty. Detached HEAD is common when users:
- check out a tag,
- inspect a specific commit,
- reproduce a CI failure,
- review a generated branch/commit from another tool.
Suggested behavior
If git branch --show-current is empty, fall back to something like:
git rev-parse --short HEAD
Then display a detached label such as:
detached@abc1234
The rest of the status calculation can still use git status --porcelain=v1 --branch; it already includes detached/head metadata that could also be parsed if preferred.
Why it matters
Detached HEAD is not an error state. Users still benefit from seeing that Kimi Code is operating inside a git repository and which commit is currently checked out.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 41m
- Merged PRs (30d)
- 345
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MoonshotAI/kimi-code
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
MoonshotAI/kimi-code#3947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MoonshotAI/kimi-code#3836 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
MoonshotAI/kimi-code#3790 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MoonshotAI/kimi-code#3755 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
MoonshotAI/kimi-code#3627 ·
All issues in MoonshotAI/kimi-code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·