Skip to content

Commit 0c18443

Browse files
committed
some more debugging on windows (#301)
1 parent 8f3bc5a commit 0c18443

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

git-worktree/src/fs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ impl Capabilities {
9696
}
9797

9898
let res = std::fs::symlink_metadata(&link_path).map(|m| m.is_symlink());
99-
let cleanup = std::fs::remove_file(&src_path);
100-
crate::os::remove_symlink(&link_path)
101-
.or_else(|_| std::fs::remove_file(&link_path))
102-
.and(cleanup)?;
99+
100+
let cleanup = crate::os::remove_symlink(&link_path).or_else(|_| std::fs::remove_file(&link_path));
101+
std::fs::remove_file(&src_path).and(cleanup)?;
102+
103103
res
104104
}
105105
}

git-worktree/src/index/entry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ where
4444
path: dest.to_path_buf(),
4545
})?;
4646

47+
#[cfg_attr(not(unix), allow(unused_mut))]
4748
let mut options = open_options(dest, destination_is_initially_empty, overwrite_existing);
4849
let needs_executable_bit = executable_bit && entry.mode == git_index::entry::Mode::FILE_EXECUTABLE;
4950
#[cfg(unix)]

git-worktree/tests/index/checkout.rs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ mod cache {
9696
}
9797
}
9898

99-
use bstr::ByteVec;
10099
#[cfg(unix)]
101100
use std::os::unix::prelude::MetadataExt;
102101
use std::{
@@ -286,20 +285,38 @@ fn keep_going_collects_results() {
286285
.unwrap();
287286

288287
assert_eq!(
289-
stripped_prefix(&destination, &dir_structure(&destination)),
290-
paths(["dir/sub-dir/symlink", "executable"]),
291-
"some files could not be created"
288+
outcome
289+
.errors
290+
.iter()
291+
.map(
292+
|r| r.error.to_string()[.."object 4f41554f6e0045ef53848fc0c3f33b6a9abc24a9 for checkout at ".len()]
293+
.to_owned()
294+
)
295+
.collect::<Vec<_>>(),
296+
[
297+
"4f41554f6e0045ef53848fc0c3f33b6a9abc24a9",
298+
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
299+
]
300+
.iter()
301+
.map(|id| format!("object {} for checkout at ", id))
302+
.collect::<Vec<_>>()
292303
);
293-
294-
assert!(outcome.collisions.is_empty());
295304
assert_eq!(
296305
outcome
297306
.errors
298-
.into_iter()
299-
.map(|r| Vec::from(r.path).into_path_buf_lossy())
307+
.iter()
308+
.map(|r| r.path.to_path_lossy().into_owned())
300309
.collect::<Vec<_>>(),
301310
paths(["dir/content", "empty"])
302311
);
312+
313+
assert_eq!(
314+
stripped_prefix(&destination, &dir_structure(&destination)),
315+
paths(["dir/sub-dir/symlink", "executable"]),
316+
"some files could not be created"
317+
);
318+
319+
assert!(outcome.collisions.is_empty());
303320
}
304321

305322
#[test]

0 commit comments

Comments
 (0)