File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,10 @@ impl CrateTrait for GitRepo {
86
86
. cd ( & path)
87
87
. process_lines ( & mut detect_private_repositories)
88
88
. run ( )
89
- . with_context ( || format ! ( "failed to update {}" , self . url) )
89
+ . with_context ( || PrepareError :: GitFailure {
90
+ action : "update" ,
91
+ url : self . url . clone ( ) ,
92
+ } )
90
93
} else {
91
94
info ! ( "cloning repository {}" , self . url) ;
92
95
Command :: new ( workspace, "git" )
@@ -95,7 +98,10 @@ impl CrateTrait for GitRepo {
95
98
. args ( & [ & path] )
96
99
. process_lines ( & mut detect_private_repositories)
97
100
. run ( )
98
- . with_context ( || format ! ( "failed to clone {}" , self . url) )
101
+ . with_context ( || PrepareError :: GitFailure {
102
+ action : "clone" ,
103
+ url : self . url . clone ( ) ,
104
+ } )
99
105
} ;
100
106
101
107
if private_repository && res. is_err ( ) {
@@ -118,7 +124,10 @@ impl CrateTrait for GitRepo {
118
124
. args ( & [ "clone" ] )
119
125
. args ( & [ self . cached_path ( workspace) . as_path ( ) , dest] )
120
126
. run ( )
121
- . with_context ( || format ! ( "failed to checkout {}" , self . url) ) ?;
127
+ . with_context ( || PrepareError :: GitFailure {
128
+ action : "checkout" ,
129
+ url : self . url . clone ( ) ,
130
+ } ) ?;
122
131
Ok ( ( ) )
123
132
}
124
133
}
Original file line number Diff line number Diff line change @@ -410,6 +410,14 @@ pub enum PrepareError {
410
410
/// cargo rejected the lockfile
411
411
#[ error( "the crate has a broken lockfile: \n \n {0}" ) ]
412
412
InvalidCargoLock ( String ) ,
413
+ /// git clone/fetch failed, but repository didn't appear to be private
414
+ #[ error( "git failed to {action} for {url}" ) ]
415
+ GitFailure {
416
+ /// action that was attempted
417
+ action : & ' static str ,
418
+ /// repo url
419
+ url : String ,
420
+ } ,
413
421
}
414
422
415
423
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments