fix: handle slashes in default branch names for code-mappings by BYK · Pull Request #1088 · getsentry/cli · GitHub
Skip to content

fix: handle slashes in default branch names for code-mappings#1088

Merged
BYK merged 1 commit into
mainfrom
fix/infer-default-branch-slash
Jun 9, 2026
Merged

fix: handle slashes in default branch names for code-mappings#1088
BYK merged 1 commit into
mainfrom
fix/infer-default-branch-slash

Conversation

@BYK

@BYK BYK commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #1087 — fixes a warden bot finding where inferDefaultBranch() truncated branch names containing slashes.

Bug

inferDefaultBranch() used output.split('/').at(-1) to extract the branch name from a git symbolic-ref output like refs/remotes/origin/main. This broke for branches with slashes:

Ref output Expected Got
refs/remotes/origin/main main main
refs/remotes/origin/release/2.0 release/2.0 2.0

Fix

Use prefix-based slicing: strip the known refs/remotes/{remote}/ prefix, preserving the full branch name regardless of slashes.

inferDefaultBranch() used split('/').at(-1) which truncated branch
names containing slashes (e.g., 'release/2.0' → '2.0'). Use
prefix-based slicing instead to preserve the full branch name.
@BYK BYK enabled auto-merge (squash) June 9, 2026 17:20
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1088/

Built to branch gh-pages at 2026-06-09 17:21 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

❌ Patch coverage is 0.00%. Project has 5022 uncovered lines.
✅ Project coverage is 81.16%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/git.ts 0.00% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.13%    81.16%    +0.03%
==========================================
  Files          383       383         —
  Lines        26671     26659       -12
  Branches     17340     17338        -2
==========================================
+ Hits         21640     21637        -3
- Misses        5031      5022        -9
- Partials      1797      1799        +2

Generated by Codecov Action

@BYK BYK merged commit 18111b9 into main Jun 9, 2026
27 checks passed
@BYK BYK deleted the fix/infer-default-branch-slash branch June 9, 2026 17:29
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