File tree 2 files changed +35
-0
lines changed
crates/crates_io_smoke_test/src 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: exit_status_ext:: ExitStatusExt ;
2
+ use std:: path:: Path ;
3
+ use tokio:: process:: Command ;
4
+
5
+ #[ allow( unstable_name_collisions) ]
6
+ pub async fn add_all ( project_path : & Path ) -> anyhow:: Result < ( ) > {
7
+ Command :: new ( "git" )
8
+ . args ( [ "add" , "--all" ] )
9
+ . current_dir ( project_path)
10
+ . status ( )
11
+ . await ?
12
+ . exit_ok ( )
13
+ . map_err ( Into :: into)
14
+ }
15
+
16
+ #[ allow( unstable_name_collisions) ]
17
+ pub async fn commit ( project_path : & Path , message : & str ) -> anyhow:: Result < ( ) > {
18
+ Command :: new ( "git" )
19
+ . args ( [ "commit" , "--message" , message] )
20
+ . current_dir ( project_path)
21
+ . status ( )
22
+ . await ?
23
+ . exit_ok ( )
24
+ . map_err ( Into :: into)
25
+ }
Original file line number Diff line number Diff line change 1
1
mod api;
2
2
mod cargo;
3
3
mod exit_status_ext;
4
+ mod git;
4
5
5
6
#[ macro_use]
6
7
extern crate tracing;
@@ -224,5 +225,14 @@ description = "test crate"
224
225
. context ( "Failed to write `README.md` file content" ) ?;
225
226
}
226
227
228
+ info ! ( "Creating initial git commit…" ) ;
229
+ git:: add_all ( & project_path)
230
+ . await
231
+ . context ( "Failed to add initial changes to git" ) ?;
232
+
233
+ git:: commit ( & project_path, "initial commit" )
234
+ . await
235
+ . context ( "Failed to commit initial changes" ) ?;
236
+
227
237
Ok ( project_path)
228
238
}
You can’t perform that action at this time.
0 commit comments