@@ -9,6 +9,46 @@ use tempfile::{TempDir, tempdir};
99fn initialize ( repository : & str , branch : & str , pull_requests : & [ & str ] , patches : & [ & str ] ) -> TempDir {
1010 let temp_dir = tempdir ( ) . expect ( "tempdir failed" ) ;
1111
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+
1252 Command :: new ( "git" )
1353 . args ( [ "init" ] )
1454 . current_dir ( temp_dir. path ( ) )
@@ -38,7 +78,7 @@ patches = {patches:?}
3878 . expect ( "git add failed" ) ;
3979
4080 Command :: new ( "git" )
41- . args ( [ "commit" , "-m=initial commit" ] )
81+ . args ( [ "commit" , "--allow-empty" , "-n" , "- m=initial commit"] )
4282 . current_dir ( temp_dir. path ( ) )
4383 . output ( )
4484 . expect ( "git commit failed" ) ;
@@ -92,8 +132,8 @@ fn test_conflicting_patches() {
92132 ) )
93133 . stderr ( predicate:: str:: contains (
94134 "✗ 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 ( ) ) ;
97137}
98138
99139#[ test]
0 commit comments