@@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
9
9
use std:: sync:: Arc ;
10
10
use std:: thread;
11
11
12
- use cargo_test_support:: git:: cargo_uses_gitoxide;
12
+ use cargo_test_support:: git:: { add_submodule , cargo_uses_gitoxide} ;
13
13
use cargo_test_support:: paths;
14
14
use cargo_test_support:: prelude:: IntoData ;
15
15
use cargo_test_support:: prelude:: * ;
@@ -3847,11 +3847,20 @@ fn corrupted_checkout_with_cli() {
3847
3847
}
3848
3848
3849
3849
fn _corrupted_checkout ( with_cli : bool ) {
3850
- let git_project = git:: new ( "dep1" , |project| {
3850
+ let ( git_project, repository ) = git:: new_repo ( "dep1" , |project| {
3851
3851
project
3852
3852
. file ( "Cargo.toml" , & basic_manifest ( "dep1" , "0.5.0" ) )
3853
3853
. file ( "src/lib.rs" , "" )
3854
3854
} ) ;
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
+
3855
3864
let p = project ( )
3856
3865
. file (
3857
3866
"Cargo.toml" ,
@@ -3882,10 +3891,12 @@ fn _corrupted_checkout(with_cli: bool) {
3882
3891
let dep1_co_path = dep1_co_paths. next ( ) . unwrap ( ) . unwrap ( ) ;
3883
3892
let dep1_ok = dep1_co_path. join ( ".cargo-ok" ) ;
3884
3893
let dep1_manifest = dep1_co_path. join ( "Cargo.toml" ) ;
3894
+ let dep2_readme = dep1_co_path. join ( "dep2/README.md" ) ;
3885
3895
3886
3896
// Deleting this file simulates an interrupted checkout.
3887
3897
t ! ( fs:: remove_file( & dep1_ok) ) ;
3888
3898
t ! ( fs:: remove_file( & dep1_manifest) ) ;
3899
+ t ! ( fs:: remove_file( & dep2_readme) ) ;
3889
3900
3890
3901
// This should refresh the checkout.
3891
3902
let mut e = p. cargo ( "fetch" ) ;
@@ -3895,6 +3906,7 @@ fn _corrupted_checkout(with_cli: bool) {
3895
3906
e. run ( ) ;
3896
3907
assert ! ( dep1_ok. exists( ) ) ;
3897
3908
assert ! ( dep1_manifest. exists( ) ) ;
3909
+ assert ! ( dep2_readme. exists( ) ) ;
3898
3910
}
3899
3911
3900
3912
#[ cargo_test]
0 commit comments