@@ -2,11 +2,11 @@ use std::{
22 cell:: RefCell ,
33 cmp:: max,
44 collections:: { BTreeMap , HashMap } ,
5- ffi:: { CStr , OsStr , OsString } ,
5+ ffi:: { CStr , OsStr } ,
66 fs:: File ,
77 io:: Write ,
88 mem:: MaybeUninit ,
9- os:: unix:: ffi:: { OsStrExt , OsStringExt } ,
9+ os:: unix:: ffi:: OsStrExt ,
1010 path:: Path ,
1111 rc:: Rc ,
1212} ;
@@ -88,24 +88,24 @@ fn write_directory(
8888fn write_leaf ( leaf : & Leaf , dirfd : & OwnedFd , name : & OsStr , repo : & Repository ) -> Result < ( ) > {
8989 let mode = leaf. stat . st_mode . into ( ) ;
9090
91- match leaf. content {
91+ match & leaf. content {
9292 LeafContent :: Regular ( RegularFile :: Inline ( ref data) ) => {
9393 set_file_contents ( dirfd, name, & leaf. stat , data) ?
9494 }
9595 LeafContent :: Regular ( RegularFile :: External ( ref id, size) ) => {
9696 let object = repo. open_object ( id) ?;
9797 // TODO: make this better. At least needs to be EINTR-safe. Could even do reflink in some cases...
98- let mut buffer = vec ! [ MaybeUninit :: uninit( ) ; size as usize ] ;
98+ let mut buffer = vec ! [ MaybeUninit :: uninit( ) ; * size as usize ] ;
9999 let ( data, _) = read ( object, & mut buffer) ?;
100100 set_file_contents ( dirfd, name, & leaf. stat , data) ?;
101101 }
102- LeafContent :: BlockDevice ( rdev) => mknodat ( dirfd, name, FileType :: BlockDevice , mode, rdev) ?,
102+ LeafContent :: BlockDevice ( rdev) => mknodat ( dirfd, name, FileType :: BlockDevice , mode, * rdev) ?,
103103 LeafContent :: CharacterDevice ( rdev) => {
104- mknodat ( dirfd, name, FileType :: CharacterDevice , mode, rdev) ?
104+ mknodat ( dirfd, name, FileType :: CharacterDevice , mode, * rdev) ?
105105 }
106106 LeafContent :: Socket => mknodat ( dirfd, name, FileType :: Socket , mode, 0 ) ?,
107107 LeafContent :: Fifo => mknodat ( dirfd, name, FileType :: Fifo , mode, 0 ) ?,
108- LeafContent :: Symlink ( ref target) => symlinkat ( target, dirfd, name) ?,
108+ LeafContent :: Symlink ( target) => symlinkat ( target. as_ref ( ) , dirfd, name) ?,
109109 }
110110
111111 Ok ( ( ) )
@@ -202,7 +202,7 @@ impl FilesystemReader<'_> {
202202 }
203203 FileType :: Symlink => {
204204 let target = readlinkat ( fd, "" , [ ] ) ?;
205- LeafContent :: Symlink ( OsString :: from_vec ( target. into_bytes ( ) ) )
205+ LeafContent :: Symlink ( OsStr :: from_bytes ( target. as_bytes ( ) ) . into ( ) )
206206 }
207207 FileType :: CharacterDevice => LeafContent :: CharacterDevice ( buf. st_rdev ) ,
208208 FileType :: BlockDevice => LeafContent :: BlockDevice ( buf. st_rdev ) ,
0 commit comments