File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ thiserror = "1.0.26"
2828bstr = { version = " 0.2.13" , default-features = false }
2929
3030document-features = { version = " 0.2.0" , optional = true }
31- symlink = " 0.1.0"
3231
3332[target .'cfg(unix)' .dependencies ]
3433libc = " 0.2.119"
3534
3635[dev-dependencies ]
3736git-testtools = { path = " ../tests/tools" }
3837git-odb = { path = " ../git-odb" }
38+ symlink = " 0.1.0"
3939
4040walkdir = " 2.3.2"
4141tempfile = " 3.2.0"
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ pub fn remove_symlink(path: &Path) -> io::Result<()> {
1515// TODO: use the `symlink` crate once it can delete directory symlinks
1616#[ cfg( windows) ]
1717pub fn remove_symlink ( path : & Path ) -> io:: Result < ( ) > {
18- dbg ! ( path, std:: fs:: symlink_metadata( path) , std:: fs:: metadata( path) ) ;
1918 if let Ok ( meta) = std:: fs:: metadata ( path) {
2019 if meta. is_file ( ) {
2120 std:: fs:: remove_file ( path) // this removes the link itself
Original file line number Diff line number Diff line change @@ -235,7 +235,8 @@ fn overwriting_files_and_lone_directories_works() {
235235 ) ;
236236
237237 let symlink = destination. path ( ) . join ( "dir/sub-dir/symlink" ) ;
238- assert ! ( std:: fs:: symlink_metadata( & symlink) . unwrap( ) . is_symlink( ) , ) ;
238+ // on windows, git won't create symlinks as its probe won't detect the capability, even though we do.
239+ assert_eq ! ( std:: fs:: symlink_metadata( & symlink) . unwrap( ) . is_symlink( ) , cfg!( unix) ) ;
239240 assert_eq ! ( std:: fs:: read( symlink) . unwrap( ) , b"other content" ) ;
240241}
241242
@@ -290,16 +291,17 @@ fn keep_going_collects_results() {
290291 . iter( )
291292 . map( |r| r. path. to_path_lossy( ) . into_owned( ) )
292293 . collect:: <Vec <_>>( ) ,
293- paths( if opts . fs . symlink {
294+ paths( if cfg! ( unix ) {
294295 [ "dir/content" , "empty" ]
295296 } else {
296- [ "dir/content" , "dir/sub-dir/symlink" ] // not actually a symlink anymore
297+ // not actually a symlink anymore, even though symlinks are supported but git think differently.
298+ [ "dir/content" , "dir/sub-dir/symlink" ]
297299 } )
298300 ) ;
299301
300302 assert_eq ! (
301303 stripped_prefix( & destination, & dir_structure( & destination) ) ,
302- paths( if opts . fs . symlink {
304+ paths( if cfg! ( unix ) {
303305 [ "dir/sub-dir/symlink" , "executable" ]
304306 } else {
305307 [ "empty" , "executable" ]
You can’t perform that action at this time.
0 commit comments