@@ -7,7 +7,7 @@ use quick_error::quick_error;
7
7
use std:: convert:: TryFrom ;
8
8
use std:: fs;
9
9
use std:: fs:: create_dir_all;
10
- use std:: path:: Path ;
10
+ use std:: path:: { Path , PathBuf } ;
11
11
use std:: time:: Duration ;
12
12
13
13
#[ cfg( unix) ]
@@ -16,23 +16,23 @@ use std::os::unix::fs::PermissionsExt;
16
16
quick_error ! {
17
17
#[ derive( Debug ) ]
18
18
pub enum Error {
19
- Utf8Error ( err: git_object:: bstr:: Utf8Error ) {
19
+ Utf8 ( err: git_object:: bstr:: Utf8Error ) {
20
20
from( )
21
21
display( "Could not convert path to UTF8: {}" , err)
22
22
}
23
- TimeError ( err: std:: time:: SystemTimeError ) {
23
+ Time ( err: std:: time:: SystemTimeError ) {
24
24
from( )
25
25
display( "Could not read file time in proper format: {}" , err)
26
26
}
27
- ToU32Error ( err: std:: num:: TryFromIntError ) {
27
+ U32Conversion ( err: std:: num:: TryFromIntError ) {
28
28
from( )
29
29
display( "Could not convert seconds to u32: {}" , err)
30
30
}
31
- IoError ( err: std:: io:: Error ) {
31
+ Io ( err: std:: io:: Error ) {
32
32
from( )
33
33
display( "IO error while writing blob or reading file metadata or changing filetype: {}" , err)
34
34
}
35
- FindOidError ( oid: git_hash:: ObjectId , path: std :: path :: PathBuf ) {
35
+ NotFound ( oid: git_hash:: ObjectId , path: PathBuf ) {
36
36
display( "unable to read sha1 file of {} ({})" , path. display( ) , oid. to_hex( ) )
37
37
}
38
38
}
56
56
create_dir_all ( dest. parent ( ) . expect ( "entry paths are never empty" ) ) ?;
57
57
match entry. mode {
58
58
git_index:: entry:: Mode :: FILE | git_index:: entry:: Mode :: FILE_EXECUTABLE => {
59
- let obj = find ( & entry. id , & mut buf) . ok_or_else ( || Error :: FindOidError ( entry. id , path. to_path_buf ( ) ) ) ?;
59
+ let obj = find ( & entry. id , & mut buf) . ok_or_else ( || Error :: NotFound ( entry. id , path. to_path_buf ( ) ) ) ?;
60
60
std:: fs:: write ( & dest, obj. data ) ?;
61
61
if entry. mode == git_index:: entry:: Mode :: FILE_EXECUTABLE {
62
62
#[ cfg( unix) ]
72
72
entry_time. push ( ( ctime?, mtime?, i) ) ;
73
73
}
74
74
git_index:: entry:: Mode :: SYMLINK => {
75
- let obj = find ( & entry. id , & mut buf) . unwrap ( ) ;
75
+ let obj = find ( & entry. id , & mut buf) . ok_or_else ( || Error :: NotFound ( entry . id , path . to_path_buf ( ) ) ) ? ;
76
76
let linked_to = obj. data . to_path ( ) ?;
77
77
if opts. symlinks {
78
78
#[ cfg( unix) ]
0 commit comments