@@ -9,6 +9,46 @@ use tempfile::{TempDir, tempdir};
9
9
fn initialize ( repository : & str , branch : & str , pull_requests : & [ & str ] , patches : & [ & str ] ) -> TempDir {
10
10
let temp_dir = tempdir ( ) . expect ( "tempdir failed" ) ;
11
11
12
+ // Initialize git with an initial commit
13
+ Command :: new ( "git" )
14
+ . args ( [ "init" ] )
15
+ . current_dir ( temp_dir. path ( ) )
16
+ . output ( )
17
+ . expect ( "git init failed" ) ;
18
+
19
+ // Create a file to commit (ensures we have something to commit)
20
+ std:: fs:: write (
21
+ temp_dir. path ( ) . join ( "README.md" ) ,
22
+ "# Test Repository\n \n This is a test repository for patchy tests." ,
23
+ )
24
+ . expect ( "writing README.md failed" ) ;
25
+
26
+ // Configure git user for CI environment
27
+ Command :: new ( "git" )
28
+ . args ( [ "config" , "user.name" , "CI Test User" ] )
29
+ . current_dir ( temp_dir. path ( ) )
30
+ . output ( )
31
+ . expect ( "git config user.name failed" ) ;
32
+
33
+ Command :: new ( "git" )
34
+ . args ( [ "config" , "user.email" , "[email protected] " ] )
35
+ . current_dir ( temp_dir. path ( ) )
36
+ . output ( )
37
+ . expect ( "git config user.email failed" ) ;
38
+
39
+ // Add and commit the README first
40
+ Command :: new ( "git" )
41
+ . args ( [ "add" , "README.md" ] )
42
+ . current_dir ( temp_dir. path ( ) )
43
+ . output ( )
44
+ . expect ( "git add README.md failed" ) ;
45
+
46
+ Command :: new ( "git" )
47
+ . args ( [ "commit" , "-m" , "Initial commit with README" ] )
48
+ . current_dir ( temp_dir. path ( ) )
49
+ . output ( )
50
+ . expect ( "git commit failed" ) ;
51
+
12
52
Command :: new ( "git" )
13
53
. args ( [ "init" ] )
14
54
. current_dir ( temp_dir. path ( ) )
@@ -38,7 +78,7 @@ patches = {patches:?}
38
78
. expect ( "git add failed" ) ;
39
79
40
80
Command :: new ( "git" )
41
- . args ( [ "commit" , "-m=initial commit" ] )
81
+ . args ( [ "commit" , "--allow-empty" , "-n" , "- m=initial commit"] )
42
82
. current_dir ( temp_dir. path ( ) )
43
83
. output ( )
44
84
. expect ( "git commit failed" ) ;
@@ -92,8 +132,8 @@ fn test_conflicting_patches() {
92
132
) )
93
133
. stderr ( predicate:: str:: contains (
94
134
"✗ Could not apply patch helix-readme-all-most, skipping" ,
95
- ) ) ;
96
- // .stdout(predicate::str::contains("Success!").not());
135
+ ) )
136
+ . stdout ( predicate:: str:: contains ( "Success!" ) . not ( ) ) ;
97
137
}
98
138
99
139
#[ test]
0 commit comments