DashboardcraftCraft git.ts: treat tag/branch prefixes…

Craft git.ts: treat tag/branch prefixes as opaque strings, not slash-split segments

Category: pattern
Confidence: 1.00
ID: 019f863a-a36f-7b21-83eb-76bb9057e79d
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 0
Source session: 0goKXKlJTHOVwC4wG
Created: 2026-07-21 17:12:34
Updated: 2026-07-21 19:50:17

Content

In src/utils/git.ts (findReleaseBranches), release branches are named <prefix>/<version> where <prefix> may itself contain slashes (e.g. release/cli). Fix: compute branch-prefix via lastIndexOf('/')/slice (not segment-count split/join) so the whole prefix is compared as one opaque unit; skip if lastSlash <= 0 (handles both no-slash branches like main and post-remote-strip edge cases, since remote-strip regex ^[^/]+\/ guarantees content exists before the first slash). Fuzzy match uses Levenshtein distance ≤ MAX_EDIT_DISTANCE=3. origin/HEAD -> origin/main entries are filtered upstream in parseGitBranchOutput before reaching this logic, not handled here. Confirmed (July 21 2026 review): the one behavior change vs old segment-count logic — a bare prefix like release no longer matches release/cli/1.2.3 — is the intended fix (prevents a bare-prefix run from claiming another product's branches), not a regression.

Move to: