Skip to content

fix: parse quoted paths in git diffs - #2557

Merged
Kobzol merged 1 commit into
rust-lang:mainfrom
ruturajr-raval:fix/quoted-diff-paths
Nov 12, 2026
Merged

Kobzol merged 1 commit into
rust-lang:mainfrom
ruturajr-raval:fix/quoted-diff-paths

Conversation

@ruturajr-raval

Copy link
Copy Markdown

Fixes #2550.

Git quotes unusual paths with C-style escapes. The diff parser expected literal a/ and b/ prefixes, so those files were silently omitted.

This decodes quoted paths in diff --git, rename from, and rename to lines without adding a dependency.

Tests:

  • cargo test --locked --workspace --all-targets
  • cargo fmt --all --check

AI-assisted; reviewed and validated by the author.

@Kobzol Kobzol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I don't like this complexity, missing diffs in the diff viewer can be a bit dangerous, so it seems worth it to fix this.

Can you please add some comments on top of the new parse functions to explain what they do? Thanks.

View changes since this review

Decode Git C-style path quoting in file headers and rename metadata so non-ASCII and escaped filenames are not silently dropped.
@rustbot

rustbot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Kobzol
Kobzol added this pull request to the merge queue Nov 12, 2026
Merged via the queue into rust-lang:main with commit 90acdcf Nov 12, 2026
4 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.

diff parser silently skips files with quoted paths

3 participants