Skip to content

fix(git): display quoted Unicode paths - #670

Merged
benvinegar merged 3 commits into
mainfrom
fix/unicode-git-paths
Aug 5, 2026
Merged

fix(git): display quoted Unicode paths#670
benvinegar merged 3 commits into
mainfrom
fix/unicode-git-paths

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • decode Git C-quoted UTF-8 pathname bytes into exact Unicode paths while keeping parser-safe patch headers for Pierre
  • preserve canonical paths across source loading, filtering, rename/copy metadata, OpenTUI models, extensions, and session APIs
  • force byte-safe Git quoting before JavaScript string decoding and sanitize paths only at human-readable terminal output boundaries
  • cover CJK/emoji additions, deletions, renames, copies, no-prefix patches, malformed escapes, source fetching, sessions, and PTY rendering

Closes #667.

Before

Before: Git octal escapes shown instead of the Unicode rename path

After

After: the exact CJK and emoji rename path is readable

Both screenshots use the same staged rename with Git's default core.quotePath=true behavior.

Testing

  • bun run typecheck
  • bun run lint
  • focused core, loader, OpenTUI, session, and registration suites: 162 passed, 1 skipped
  • bun run test:integration: 87 passed
  • bun run test:tty-smoke: 9 passed
  • Unicode rename PTY regression after the final rebase: passed

The unrestricted bun test command still discovers website Playwright specs under Bun and encounters unrelated existing test-runner failures; all affected and integration suites pass.

This PR description was generated by Pi using OpenAI GPT-5.4

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Aug 5, 2026 2:43pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR decodes Git C-quoted UTF-8 pathname bytes while retaining parser-safe patch headers and propagates exact paths through core, OpenTUI, source-loading, and session surfaces.

  • Adds exact decoded-path metadata alongside normalized patch text.
  • Forces Git byte-safe pathname quoting and extends Unicode path coverage.
  • Sanitizes session paths at human-readable terminal output boundaries.

Confidence Score: 4/5

The tab-width rendering defect should be fixed before merging because valid decoded filenames can corrupt OpenTUI header and sidebar layout.

Exact decoded tab characters now reach renderers that preserve tabs but measure them as one terminal cell, so clipping and padding can diverge from the displayed width.

Files Needing Attention: src/opentui/model.ts and the shared terminal path-rendering utilities

Important Files Changed

Filename Overview
src/core/patch/gitFormat.ts Adds separate parser-safe and exact Git C-quoted pathname decoding, including rename and copy metadata.
src/core/loaders.ts Attaches exact decoded paths to parsed core models and source fetchers.
src/opentui/model.ts Propagates exact paths into public OpenTUI models, exposing literal tabs to width-sensitive renderers.
src/core/vcs/git.ts Forces core.quotePath=true so Git output remains byte-safe before JavaScript decoding.
src/session/agent/cliClient.ts Sanitizes path-like values only when formatting human-readable terminal output.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Git[Git or external patch] --> Normalize[Normalize parser-safe headers]
  Normalize --> Parse[Pierre patch parser]
  Normalize --> Exact[Decode exact quoted paths]
  Parse --> Model[Diff metadata]
  Exact --> Model
  Model --> Core[Core source loading]
  Model --> OpenTUI[OpenTUI models]
  Model --> Session[Session APIs]
  OpenTUI --> Sanitize[Terminal display sanitization]
  Session --> Sanitize
Loading
Prompt To Fix All With AI
### Issue 1
src/opentui/model.ts:82
**Decoded tabs break width accounting**

When a tracked filename contains a tab encoded by Git as `\t`, this assignment exposes the literal tab to shared file-header and sidebar renderers; their sanitizer preserves tabs while width calculations count each tab as one cell, causing terminal expansion to corrupt alignment and push statistics outside their allocated columns.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(git): decode quoted Unicode paths" | Re-trigger Greptile

Comment thread src/opentui/model.ts
@benvinegar
benvinegar force-pushed the fix/unicode-git-paths branch from 4cd068f to 8cc7d8e Compare August 5, 2026 14:42
@benvinegar
benvinegar merged commit 45af37c into main Aug 5, 2026
17 of 18 checks passed
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.

Display Git-quoted CJK and emoji paths as Unicode

1 participant