From 9541a094d832c14f0744d974e352146e0096630f Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Fri, 21 Aug 2026 17:58:54 -0600 Subject: [PATCH] fix: make bundle provenance portable to Windows Provenance records stored OS-native path separators, making installed-bundles.yaml non-portable; slug derivation treated a Windows drive letter as an scp host and swallowed the whole path into one sanitized segment. Store paths are now always forward-slashed and backslashes normalize before URL parsing. Test fixture repos commit a '* -text' .gitattributes so clone-side autocrlf cannot rewrite content assertions. --- src/config/install_remote.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config/install_remote.rs b/src/config/install_remote.rs index 9bf6a84..b747f3d 100644 --- a/src/config/install_remote.rs +++ b/src/config/install_remote.rs @@ -1076,6 +1076,7 @@ fn strip_ref_suffix(url: &str) -> &str { fn split_host_and_path(url: &str) -> (String, String) { let url = strip_ref_suffix(url); + let url = &url.replace('\\', "/"); if let Some((_, rest)) = url.split_once("://") { let (authority, path) = rest.split_once('/').unwrap_or((rest, "")); let host = authority.rsplit_once('@').map_or(authority, |(_, h)| h); @@ -1544,10 +1545,8 @@ fn record_written_file( } fn provenance_path(dst: &Path) -> String { - dst.strip_prefix(paths::config_dir()) - .unwrap_or(dst) - .to_string_lossy() - .into_owned() + let rel = dst.strip_prefix(paths::config_dir()).unwrap_or(dst); + rel.to_string_lossy().replace('\\', "/") } /// Record the mcp.json entries the merge actually wrote, in one flush right @@ -2807,6 +2806,7 @@ mod tests { fn init_git_repo(dir: &Path) -> String { run_git(vec!["init".into(), "-q".into(), dir.as_os_str().into()]).unwrap(); + fs::write(dir.join(".gitattributes"), "* -text\n").unwrap(); commit_file(dir, "seed.txt", "one") } @@ -2860,6 +2860,7 @@ mod tests { fn init_bundle_repo(dir: &Path) -> String { run_git(vec!["init".into(), "-q".into(), dir.as_os_str().into()]).unwrap(); + fs::write(dir.join(".gitattributes"), "* -text\n").unwrap(); commit_file(dir, ".seed", "seed") }