Skip to content

fix(patch): parse Windows drive-letter paths#10808

Open
ilepn wants to merge 3 commits intoanomalyco:devfrom
ilepn:fix/windows-drive-letter-apply-patch
Open

fix(patch): parse Windows drive-letter paths#10808
ilepn wants to merge 3 commits intoanomalyco:devfrom
ilepn:fix/windows-drive-letter-apply-patch

Conversation

@ilepn
Copy link
Copy Markdown

@ilepn ilepn commented Jan 27, 2026

Why

On Windows, apply_patch headers like "*** Update File: D:..." were truncated at the drive letter because the patch header parser split on ':'; this produced paths like 'D' and caused apply_patch to fail.

Fixes #10360.

What

  • Parse patch header paths by slicing after the known header prefix instead of splitting on ':'
  • Add regression tests for drive-letter update and move paths

Test

  • bun test test/patch/patch.test.ts

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@ilepn
Copy link
Copy Markdown
Author

ilepn commented Jan 27, 2026

Note: I ran a headless ApplyPatchTool check with Windows path variants. Drive-letter, UNC (\localhost\c$...), and ADS paths worked end-to-end. The ?\ long-path form still fails later in ApplyPatchTool due to path.resolve normalization (separate issue). The ?\ parser test is kept to ensure header parsing preserves the path string.

@machinekoder
Copy link
Copy Markdown

I independently arrived at the same fix on Windows (see #13582) and can confirm this resolves the issue. Tested on Windows 11 — patches with absolute drive-letter paths like D:\repos\project\src\file.ts now parse correctly instead of truncating to just the drive letter.

Happy to close my duplicate PR if this one gets merged.

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.

Windows apply_patch fails

3 participants