@@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
99use std:: sync:: Arc ;
1010use std:: thread;
1111
12- use cargo_test_support:: git:: cargo_uses_gitoxide;
12+ use cargo_test_support:: git:: { add_submodule , cargo_uses_gitoxide} ;
1313use cargo_test_support:: paths;
1414use cargo_test_support:: prelude:: IntoData ;
1515use cargo_test_support:: prelude:: * ;
@@ -3847,11 +3847,20 @@ fn corrupted_checkout_with_cli() {
38473847}
38483848
38493849fn _corrupted_checkout ( with_cli : bool ) {
3850- let git_project = git:: new ( "dep1" , |project| {
3850+ let ( git_project, repository ) = git:: new_repo ( "dep1" , |project| {
38513851 project
38523852 . file ( "Cargo.toml" , & basic_manifest ( "dep1" , "0.5.0" ) )
38533853 . file ( "src/lib.rs" , "" )
38543854 } ) ;
3855+
3856+ let project2 = git:: new ( "dep2" , |project| {
3857+ project. no_manifest ( ) . file ( "README.md" , "" )
3858+ } ) ;
3859+ let url = project2. root ( ) . to_url ( ) . to_string ( ) ;
3860+ add_submodule ( & repository, & url, Path :: new ( "dep2" ) ) ;
3861+ git:: commit ( & repository) ;
3862+ drop ( repository) ;
3863+
38553864 let p = project ( )
38563865 . file (
38573866 "Cargo.toml" ,
@@ -3882,10 +3891,12 @@ fn _corrupted_checkout(with_cli: bool) {
38823891 let dep1_co_path = dep1_co_paths. next ( ) . unwrap ( ) . unwrap ( ) ;
38833892 let dep1_ok = dep1_co_path. join ( ".cargo-ok" ) ;
38843893 let dep1_manifest = dep1_co_path. join ( "Cargo.toml" ) ;
3894+ let dep2_readme = dep1_co_path. join ( "dep2/README.md" ) ;
38853895
38863896 // Deleting this file simulates an interrupted checkout.
38873897 t ! ( fs:: remove_file( & dep1_ok) ) ;
38883898 t ! ( fs:: remove_file( & dep1_manifest) ) ;
3899+ t ! ( fs:: remove_file( & dep2_readme) ) ;
38893900
38903901 // This should refresh the checkout.
38913902 let mut e = p. cargo ( "fetch" ) ;
@@ -3895,6 +3906,7 @@ fn _corrupted_checkout(with_cli: bool) {
38953906 e. run ( ) ;
38963907 assert ! ( dep1_ok. exists( ) ) ;
38973908 assert ! ( dep1_manifest. exists( ) ) ;
3909+ assert ! ( dep2_readme. exists( ) ) ;
38983910}
38993911
39003912#[ cargo_test]
0 commit comments