File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1049,6 +1049,19 @@ pub enum FileMode {
10491049 Commit ,
10501050}
10511051
1052+ impl From < FileMode > for i32 {
1053+ fn from ( mode : FileMode ) -> i32 {
1054+ match mode {
1055+ FileMode :: Unreadable => raw:: GIT_FILEMODE_UNREADABLE as i32 ,
1056+ FileMode :: Tree => raw:: GIT_FILEMODE_TREE as i32 ,
1057+ FileMode :: Blob => raw:: GIT_FILEMODE_BLOB as i32 ,
1058+ FileMode :: BlobExecutable => raw:: GIT_FILEMODE_BLOB_EXECUTABLE as i32 ,
1059+ FileMode :: Link => raw:: GIT_FILEMODE_LINK as i32 ,
1060+ FileMode :: Commit => raw:: GIT_FILEMODE_COMMIT as i32 ,
1061+ }
1062+ }
1063+ }
1064+
10521065impl From < FileMode > for u32 {
10531066 fn from ( mode : FileMode ) -> u32 {
10541067 match mode {
@@ -1465,6 +1478,8 @@ mod tests {
14651478
14661479 #[ test]
14671480 fn convert_filemode ( ) {
1481+ assert_eq ! ( i32 :: from( FileMode :: Blob ) , 0o100644 ) ;
1482+ assert_eq ! ( i32 :: from( FileMode :: BlobExecutable ) , 0o100755 ) ;
14681483 assert_eq ! ( u32 :: from( FileMode :: Blob ) , 0o100644 ) ;
14691484 assert_eq ! ( u32 :: from( FileMode :: BlobExecutable ) , 0o100755 ) ;
14701485 }
You can’t perform that action at this time.
0 commit comments