fix(desktop): preserve diff counts for compact rename paths

NI
20d ago
+18-1

What & why

Renaming an edited file within a directory produces Git numstat output such as 1\t1\tsrc/{old => new}/file.ts. The parser treated the text around => as two complete paths, so neither key matched src/new/file.ts and the Changes list retained zero additions and deletions.

Expand the compact rename into complete old and new paths before storing the counts. Keep the existing handling of plain old => new paths. This changes the shared parser used by the desktop Git worker; no renderer or tRPC contract changes are needed.

How I tested it

  • Added a regression that failed on the original parser and passes after the fix.
  • Parser suite: 40 passed, 0 failed.
  • Biome 2.4.2 check passed for both changed files.
  • Created a real temporary Git repository, committed a file, renamed its directory, edited one line, and staged it. Git emitted 1\t1\tsrc/{old => new}/file.ts; the fixed parser assigned +1/-1 to both complete paths.
  • git diff --check passed.
  • Full lint, desktop typecheck and manual app QA were not run. Only a filtered dependency installation was provisioned; a broader utility-test attempt could not load commit-failure.test.ts because @trpc/server was unavailable. The parser suite itself has no missing dependencies and passes.

Checklist

  • PR title follows conventional commits.
  • Full bun run lint and bun run typecheck pass (scoped Biome check passed; full workspace checks are left to CI).
  • Allow edits from maintainers is enabled on the fork PR.
  • Contributor has signed the CLA (the contributor must complete any required signature personally).

Prepared with OpenAI Codex. The listed automated checks and Git reproduction were executed by the agent; no manual desktop verification is claimed.


Summary by cubic

Fixes the desktop Git numstat parser so renamed files in compact form (like src/{old => new}/file.ts) keep their diff counts.

Previously the parser treated the text around => as two complete paths, so neither matched src/new/file.ts and renamed files showed zero additions and deletions. The parser now expands compact rename paths into complete old and new paths while keeping existing handling of plain old => new paths.

  • Adds a regression test covering the compact rename path format.
  • Changes only the shared parser used by the desktop Git worker; no renderer or tRPC contract changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved change statistics for renamed files so additions and deletions appear under both the old and new paths, including compact rename formats.