Skip to content

Commit 4f52cef

Browse files
timabellclaude
andcommitted
Normalize backslashes in temp path for Windows compatibility
On Windows, canonicalize() returns paths with backslashes but git stores URLs with forward slashes. Convert backslashes to forward slashes before stripping the temp path prefix. Prompts: - "windows failed - https://github.com/timabell/gitopolis/actions/runs/19770885497/job/56654534705 ..." Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bffdd97 commit 4f52cef

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/end_to_end_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,8 +2604,9 @@ url = "source_zzz"
26042604

26052605
// git clone converts relative local paths to absolute, so strip the temp path prefix
26062606
// Use canonicalize to resolve symlinks (e.g., /var -> /private/var on macOS)
2607+
// On Windows, canonicalize uses backslashes but git uses forward slashes, so normalize
26072608
let temp_path_canonical = temp.path().canonicalize().unwrap();
2608-
let temp_path_str = temp_path_canonical.to_str().unwrap();
2609+
let temp_path_str = temp_path_canonical.to_str().unwrap().replace('\\', "/");
26092610
let remotes = remotes.replace(&format!("{}/", temp_path_str), "");
26102611

26112612
let expected_remotes = r#"aaa source_aaa (fetch)
@@ -2665,8 +2666,9 @@ url = "source_bbb"
26652666

26662667
// git clone converts relative local paths to absolute, so strip the temp path prefix
26672668
// Use canonicalize to resolve symlinks (e.g., /var -> /private/var on macOS)
2669+
// On Windows, canonicalize uses backslashes but git uses forward slashes, so normalize
26682670
let temp_path_canonical = temp.path().canonicalize().unwrap();
2669-
let temp_path_str = temp_path_canonical.to_str().unwrap();
2671+
let temp_path_str = temp_path_canonical.to_str().unwrap().replace('\\', "/");
26702672
let remotes = remotes.replace(&format!("{}/", temp_path_str), "");
26712673

26722674
// Should have aaa and bbb remotes, NOT origin

0 commit comments

Comments
 (0)