Skip to content

fix: handle CRLF line endings when parsing git worktree and remote lists - #3

Open
SuparvaCode wants to merge 1 commit into
carlassmann:mainfrom
SuparvaCode:fix/crlf-worktree-parsing
Open

SuparvaCode wants to merge 1 commit into
carlassmann:mainfrom
SuparvaCode:fix/crlf-worktree-parsing

Conversation

@SuparvaCode

Copy link
Copy Markdown

Closes #2.

This PR makes git output parsing in \src/git.ts\ resilient against CRLF (\r\n) line endings:

  • \gitMainWorktree: split by /\r?\n/\ and trim the path extracted from \worktree .
  • \parseWorktreeList: split by /\r?\n/\ and trim \worktree, \�ranch, and \prunable\ values so trailing \r\ won't interfere with path checks or branch matching.
  • \listRemotes: split by /\r?\n/\ and trim remote names before filtering.
  • Added a unit test in \src/git.test.ts\ covering porcelain worktree parsing with CRLF line endings.

All checks (\�un run check\ - tsc, oxlint, knip) and git unit tests pass.


[Deutsche Übersetzung / German translation]
(Schließt #2.
Dieser PR sorgt dafür, dass das Parsen der Git-Ausgaben in \src/git.ts\ auch mit CRLF-Zeilenumbrüchen (\r\n) zuverlässig funktioniert:

  • \gitMainWorktree: Trennung nach /\r?\n/\ und Trimmen des extrahierten Pfads.
  • \parseWorktreeList: Trennung nach /\r?\n/\ und Trimmen von \worktree, \�ranch\ und \prunable, damit kein anhängendes \r\ Pfadprüfungen oder Branch-Vergleiche stört.
  • \listRemotes: Trennung nach /\r?\n/\ und Trimmen der Remote-Namen.
  • Neuer Unit-Test in \src/git.test.ts\ für das Parsen von Worktrees mit CRLF.
    Alle Checks (\ sc, \oxlint, \knip) und Unit-Tests laufen fehlerfrei durch.)

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.

Handle CRLF line endings when parsing porcelain worktree and remote lists

1 participant