Skip to content

fix: preserve remote branch names containing HEAD - #1730

Open
unknowlei wants to merge 1 commit into
eyaltoledano:nextfrom
unknowlei:fix/preserve-head-named-remote-branches
Open

unknowlei wants to merge 1 commit into
eyaltoledano:nextfrom
unknowlei:fix/preserve-head-named-remote-branches

Conversation

@unknowlei

@unknowlei unknowlei commented Oct 2, 2026 •

Copy link
Copy Markdown

The remote branch filter currently drops any line containing HEAD, so valid branches such as fix/HEAD-request and feature/HEAD disappear from the result. A remote named HEADquarters also causes all of its branches to be skipped.

This removes the remote prefix first and only filters out the actual HEAD reference. The regression tests cover those names, remote HEAD references, duplicate branches, and failed Git commands. Two tests fail before the fix; all six focused tests pass with Vitest 4.0.10. A patch changeset is included, and this PR targets next.

Summary by CodeRabbit

  • Bug Fixes
    • Remote branch names containing “HEAD” are now preserved, while the remote HEAD reference continues to be excluded.
  • Tests
    • Added coverage for branch filtering, duplicate and empty entries, Git failures, and missing project roots.

@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4edd604

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
task-master-ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (3)
.cursor/rules/utilities.mdc — auto-discovered
CLAUDE.md — auto-discovered
.cursor/rules/test_workflow.mdc — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: eyaltoledano/claude-task-master/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 471bb184-d559-4a82-805f-b7c993225e94

📥 Commits

Reviewing files that changed from the base of the PR and between 487c3d3 and 4edd604.

📒 Files selected for processing (3)
  • .changeset/fix-head-named-remote-branches.md
  • packages/tm-core/src/common/utils/git-utils.spec.ts
  • packages/tm-core/src/common/utils/git-utils.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

getRemoteBranches now removes the remote prefix before filtering. It excludes exact HEAD references while preserving branch names containing HEAD. Tests cover filtering and error cases, and a patch changeset documents the change.

Changes

Remote branch filtering

Layer / File(s) Summary
Filter remote branches and validate results
packages/tm-core/src/common/utils/git-utils.ts, packages/tm-core/src/common/utils/git-utils.spec.ts, .changeset/fix-head-named-remote-branches.md
getRemoteBranches now strips the remote prefix before filtering and excludes only exact HEAD references. Tests cover branch names containing HEAD, excluded remote HEAD references, empty lines, duplicates, Git failures, and an empty project root. The changeset describes the patch.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 4edd6

Branch names containing HEAD are preserved while the remote HEAD reference is excluded; no actionable merge risk remains in the reviewed changes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving remote branch names that contain HEAD.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

Warning

Some tools did not complete. Review the errors below.

🔧 Biome (2.5.13)
packages/tm-core/src/common/utils/git-utils.spec.ts

Biome could not lint this file: configuration resulted in errors. Check the repository's Biome configuration and plugins.

packages/tm-core/src/common/utils/git-utils.ts

Biome could not lint this file: configuration resulted in errors. Check the repository's Biome configuration and plugins.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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