Skip to content

Commit 5e39ddd

Browse files
timabellclaude
andcommitted
Strip temp path prefix in clone tests for git's absolute path behavior
git clone converts relative local paths to absolute paths when storing the remote URL. This fix strips the temp path prefix from the git remote output before comparing, allowing the tests to verify the correct remote names without being affected by git's path normalization. Prompts: - "okay, that's annoying, if you git clone ../ it does indeed make it relative. so we're going to have strip the temp path from the output. blergh." - "nope, wrong, run the test" - "commit" Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 195ed69 commit 5e39ddd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/end_to_end_tests.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,6 +2602,10 @@ url = "source_zzz"
26022602
.expect("git remote --verbose failed");
26032603
let remotes = String::from_utf8(remotes_output.stdout).expect("utf8 conversion failed");
26042604

2605+
// git clone converts relative local paths to absolute, so strip the temp path prefix
2606+
let temp_path_str = temp.path().to_str().unwrap();
2607+
let remotes = remotes.replace(&format!("{}/", temp_path_str), "");
2608+
26052609
let expected_remotes = r#"aaa source_aaa (fetch)
26062610
aaa source_aaa (push)
26072611
origin source_origin (fetch)
@@ -2657,6 +2661,10 @@ url = "source_bbb"
26572661
.expect("git remote --verbose failed");
26582662
let remotes = String::from_utf8(remotes_output.stdout).expect("utf8 conversion failed");
26592663

2664+
// git clone converts relative local paths to absolute, so strip the temp path prefix
2665+
let temp_path_str = temp.path().to_str().unwrap();
2666+
let remotes = remotes.replace(&format!("{}/", temp_path_str), "");
2667+
26602668
// Should have aaa and bbb remotes, NOT origin
26612669
let expected_remotes = r#"aaa source_aaa (fetch)
26622670
aaa source_aaa (push)

0 commit comments

Comments
 (0)