Skip to content

fix: reject default branch names starting with '-' - #96

Merged
him0 merged 1 commit into
mainfrom
fix/reject-dash-default-branch
Nov 20, 2026
Merged

him0 merged 1 commit into
mainfrom
fix/reject-dash-default-branch

Conversation

@him0

@him0 him0 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • getDefaultBranch now rejects a default branch name starting with -.
  • The name comes from refs/remotes/<remote>/HEAD, which the remote chooses, and ref names may start with - (e.g. refs/heads/-f). When the checked-out branch is deleted, checkoutDefaultBranchArgs passes it to git checkout, which would read -f as an option and discard uncommitted changes.
  • Addresses code scanning alert Add Claude Code GitHub Workflow #2 (CWE-88).

Test plan

  • mise run test (adds TestRunRejectsDashDefaultBranch)
  • mise run lint

🤖 Generated with Claude Code

The default branch name comes from refs/remotes/<remote>/HEAD, which the
remote chooses, and ref names may start with '-'. When the checked-out
branch is deleted, the name is passed to `git checkout`, which would
read a name such as "-f" as an option and discard local changes.
getDefaultBranch now rejects such a name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cf32db11-beaf-427c-b9ee-a6fbf147f62c
Commits

Reviewing files that changed from the base of the PR and between cc6330c and d0f2548.

Files selected for processing: 2

  • main.go
  • main_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@him0
him0 merged commit 68ae848 into main Nov 20, 2026
6 checks passed
@him0
him0 deleted the fix/reject-dash-default-branch branch November 20, 2026 19:37
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