fix: git gets plain Windows paths; the FIFO test is Unix-only (P11c)
std::fs::canonicalize on Windows returns \\?\C:\..., which git refuses
("not a git repository"): every argument handed to git now has the
extended-length prefix taken off (root::without_extended_prefix, with a
unit test that runs everywhere; \\?\UNC\ becomes \\). The access-record
test's fixture is a FIFO in the log's place, which Windows has no
counterpart for; the refusal path is the same code on every system, so
the test and its helper are Unix-only. main (8f0e5f08) merged in.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
fa7c2805a6
commit
9f57269def
3 files changed
+45
-3
No files matched your search
@@ -223,7 +223,13 @@ impl Git {
|
||||
fn run(&self, what: &str, args: &[&std::ffi::OsStr]) -> Result<String, BackupError> {
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
let mut c = self.command();
|
||||
c.args(args);
|
||||
// A path made canonical on Windows carries `\\?\`, which git refuses.
|
||||
c.args(args.iter().map(|a| match a.to_str() {
|
||||
Some(text) if text.contains(r"\\?\") => {
|
||||
std::ffi::OsString::from(crate::root::without_extended_prefix(text))
|
||||
}
|
||||
_ => (*a).to_os_string(),
|
||||
}));
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::CommandExt;
|
||||
|
||||
Reference in new issue
Block a user