@@ -48,35 +48,35 @@ impl GitCli {
48
48
let output = self
49
49
. git_command ( )
50
50
// The -z causes files to not be quoted, and to be separated by \0.
51
- . args ( & [ "ls-files" , "-z" ] )
51
+ . args ( [ "ls-files" , "-z" ] )
52
52
. output ( )
53
53
. map_err ( |err| SystemError :: io ( "running git ls-files" , err) ) ?;
54
54
if !output. status . success ( ) {
55
- return Err ( SystemError :: Exec {
55
+ return Err ( Box :: new ( SystemError :: Exec {
56
56
cmd : "git ls-files" ,
57
57
status : output. status ,
58
- } ) ;
58
+ } ) ) ;
59
59
}
60
60
61
61
Utf8Paths0 :: from_bytes ( output. stdout )
62
- . map_err ( |( path, err) | SystemError :: NonUtf8Path { path, err } )
62
+ . map_err ( |( path, err) | Box :: new ( SystemError :: NonUtf8Path { path, err } ) )
63
63
} )
64
64
}
65
65
66
66
/// Returns the merge base of the current commit (`HEAD`) with the specified commit.
67
67
pub fn merge_base ( & self , commit_ref : & str ) -> Result < GitHash > {
68
68
let output = self
69
69
. git_command ( )
70
- . args ( & [ "merge-base" , "HEAD" , commit_ref] )
70
+ . args ( [ "merge-base" , "HEAD" , commit_ref] )
71
71
. output ( )
72
72
. map_err ( |err| {
73
73
SystemError :: io ( format ! ( "running git merge-base HEAD {}" , commit_ref) , err)
74
74
} ) ?;
75
75
if !output. status . success ( ) {
76
- return Err ( SystemError :: Exec {
76
+ return Err ( Box :: new ( SystemError :: Exec {
77
77
cmd : "git merge-base" ,
78
78
status : output. status ,
79
- } ) ;
79
+ } ) ) ;
80
80
}
81
81
82
82
// The output is a hex-encoded hash followed by a newline.
@@ -96,7 +96,7 @@ impl GitCli {
96
96
diff_filter : Option < & str > ,
97
97
) -> Result < Utf8Paths0 > {
98
98
let mut command = self . git_command ( ) ;
99
- command. args ( & [ "diff" , "-z" , "--name-only" ] ) ;
99
+ command. args ( [ "diff" , "-z" , "--name-only" ] ) ;
100
100
if let Some ( diff_filter) = diff_filter {
101
101
command. arg ( format ! ( "--diff-filter={}" , diff_filter) ) ;
102
102
}
@@ -109,14 +109,14 @@ impl GitCli {
109
109
. output ( )
110
110
. map_err ( |err| SystemError :: io ( "running git diff" , err) ) ?;
111
111
if !output. status . success ( ) {
112
- return Err ( SystemError :: Exec {
112
+ return Err ( Box :: new ( SystemError :: Exec {
113
113
cmd : "git diff" ,
114
114
status : output. status ,
115
- } ) ;
115
+ } ) ) ;
116
116
}
117
117
118
118
Utf8Paths0 :: from_bytes ( output. stdout )
119
- . map_err ( |( path, err) | SystemError :: NonUtf8Path { path, err } )
119
+ . map_err ( |( path, err) | Box :: new ( SystemError :: NonUtf8Path { path, err } ) )
120
120
}
121
121
122
122
/// Returns a package graph for the given commit, using a scratch repo if necessary.
@@ -139,7 +139,7 @@ impl GitCli {
139
139
// Check that the project root and the Git root match.
140
140
let output = self
141
141
. git_command ( )
142
- . args ( & [ "rev-parse" , "--show-toplevel" ] )
142
+ . args ( [ "rev-parse" , "--show-toplevel" ] )
143
143
. stderr ( Stdio :: inherit ( ) )
144
144
. output ( )
145
145
. map_err ( |err| SystemError :: io ( "running git rev-parse --show-toplevel" , err) ) ?;
@@ -189,7 +189,7 @@ impl GitCli {
189
189
/// performance reasons.
190
190
fn get_or_init_scratch ( & self , hash : & GitHash ) -> Result < Utf8PathBuf > {
191
191
let mut scratch_dir = self . root . join ( "target" ) ;
192
- scratch_dir. extend ( & [ "x-scratch" , "tree" ] ) ;
192
+ scratch_dir. extend ( [ "x-scratch" , "tree" ] ) ;
193
193
194
194
if scratch_dir. is_dir ( ) && self . is_git_repo ( & scratch_dir) ? {
195
195
debug ! ( "Using existing scratch worktree at {}" , scratch_dir, ) ;
@@ -199,14 +199,14 @@ impl GitCli {
199
199
. git_command ( )
200
200
. current_dir ( & scratch_dir)
201
201
// TODO: also git clean?
202
- . args ( & [ "reset" , & format ! ( "{:x}" , hash) , "--hard" ] )
202
+ . args ( [ "reset" , & format ! ( "{:x}" , hash) , "--hard" ] )
203
203
. output ( )
204
204
. map_err ( |err| SystemError :: io ( "running git checkout in scratch tree" , err) ) ?;
205
205
if !output. status . success ( ) {
206
- return Err ( SystemError :: Exec {
206
+ return Err ( Box :: new ( SystemError :: Exec {
207
207
cmd : "git checkout" ,
208
208
status : output. status ,
209
- } ) ;
209
+ } ) ) ;
210
210
}
211
211
} else {
212
212
if scratch_dir. is_dir ( ) {
@@ -218,16 +218,16 @@ impl GitCli {
218
218
info ! ( "Setting up scratch worktree in {}" , scratch_dir) ;
219
219
let output = self
220
220
. git_command ( )
221
- . args ( & [ "worktree" , "add" ] )
221
+ . args ( [ "worktree" , "add" ] )
222
222
. arg ( & scratch_dir)
223
- . args ( & [ & format ! ( "{:x}" , hash) , "--detach" ] )
223
+ . args ( [ & format ! ( "{:x}" , hash) , "--detach" ] )
224
224
. output ( )
225
225
. map_err ( |err| SystemError :: io ( "running git worktree add" , err) ) ?;
226
226
if !output. status . success ( ) {
227
- return Err ( SystemError :: Exec {
227
+ return Err ( Box :: new ( SystemError :: Exec {
228
228
cmd : "git worktree add" ,
229
229
status : output. status ,
230
- } ) ;
230
+ } ) ) ;
231
231
}
232
232
}
233
233
@@ -240,7 +240,7 @@ impl GitCli {
240
240
let output = self
241
241
. git_command ( )
242
242
. current_dir ( dir)
243
- . args ( & [ "rev-parse" , "--git-dir" ] )
243
+ . args ( [ "rev-parse" , "--git-dir" ] )
244
244
. output ( )
245
245
. map_err ( |err| SystemError :: io ( "checking if a directory is a git repo" , err) ) ?;
246
246
@@ -270,6 +270,6 @@ impl<'a, 'b> From<&'a GitHash> for Cow<'b, OsStr> {
270
270
271
271
impl fmt:: LowerHex for GitHash {
272
272
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
273
- write ! ( f, "{}" , hex:: encode( & self . 0 ) )
273
+ write ! ( f, "{}" , hex:: encode( self . 0 ) )
274
274
}
275
275
}
0 commit comments