Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Windows fs::canonicalize() returns paths with the \\?\ verbatim prefix, which git cannot parse when formatted as file:// URLs.

Changes

  • Added path_to_file_url() helper in src/tests/helpers/repo.rs
    • Windows: strips \\?\ prefix, converts backslashes to forward slashes, uses file:/// format
    • Unix/Linux: preserves existing file:// behavior
  • Updated two call sites constructing file:// URLs to use the helper
/// Convert a file path to a proper file:// URL that git can understand.
/// On Windows, this handles the `\\?\` prefix and ensures forward slashes.
fn path_to_file_url(path: &Path) -> String {
    let path_str = path.to_str().unwrap();
    
    #[cfg(windows)]
    {
        // Remove Windows verbatim path prefix `\\?\` if present
        let normalized = path_str
            .strip_prefix(r"\\?\")
            .unwrap_or(path_str)
            .replace('\\', "/");
        format!("file:///{}", normalized)
    }
    
    #[cfg(not(windows))]
    {
        format!("file://{}", path_str)
    }
}
Original prompt

Fix the windows CI issues


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 14, 2025
Copilot AI changed the title [WIP] Fix Windows CI issues Fix Windows CI: Handle \\?\ prefix in file:// URLs Nov 14, 2025
Copilot AI requested a review from altsem November 14, 2025 21:46
@altsem altsem closed this Nov 14, 2025
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.

2 participants