File tree Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Expand file tree Collapse file tree 4 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,12 @@ fn common_values_and_names_by_path() -> crate::Result {
14
14
assert_eq ! (
15
15
modules
16
16
. iter( )
17
- . map( |m| m. config_path( ) . expect( "present" ) . to_owned( ) )
17
+ . map( |m| { m. config_path( ) . expect( "present" ) . to_owned( ) } )
18
18
. collect:: <Vec <_>>( ) ,
19
19
[
20
20
"empty-clone/.gitmodules" ,
21
21
"multiple/.gitmodules" ,
22
+ "not-a-submodule/.gitmodules" ,
22
23
"recursive-clone/.gitmodules" ,
23
24
"recursive-clone/submodule/.gitmodules" ,
24
25
"relative-clone/.gitmodules" ,
Original file line number Diff line number Diff line change @@ -5,11 +5,9 @@ fn submodule(bytes: &str) -> gix_submodule::File {
5
5
mod is_active_platform {
6
6
use std:: str:: FromStr ;
7
7
8
- use bstr:: { BStr , ByteSlice } ;
9
-
10
- fn multi_modules ( ) -> crate :: Result < gix_submodule:: File > {
8
+ fn module_file ( name : & str ) -> crate :: Result < gix_submodule:: File > {
11
9
let modules = gix_testtools:: scripted_fixture_read_only ( "basic.sh" ) ?
12
- . join ( "multiple" )
10
+ . join ( name )
13
11
. join ( ".gitmodules" ) ;
14
12
Ok ( gix_submodule:: File :: from_bytes (
15
13
std:: fs:: read ( & modules) ?. as_slice ( ) ,
@@ -18,6 +16,12 @@ mod is_active_platform {
18
16
) ?)
19
17
}
20
18
19
+ use bstr:: { BStr , ByteSlice } ;
20
+
21
+ fn multi_modules ( ) -> crate :: Result < gix_submodule:: File > {
22
+ module_file ( "multiple" )
23
+ }
24
+
21
25
fn assume_valid_active_state < ' a > (
22
26
module : & ' a gix_submodule:: File ,
23
27
config : & ' a gix_config:: File < ' static > ,
@@ -52,6 +56,17 @@ mod is_active_platform {
52
56
. collect ( ) )
53
57
}
54
58
59
+ #[ test]
60
+ fn without_submodule_in_index ( ) -> crate :: Result {
61
+ let module = module_file ( "not-a-submodule" ) ?;
62
+ assert_eq ! (
63
+ module. names( ) . map( ToOwned :: to_owned) . collect:: <Vec <_>>( ) ,
64
+ [ "submodule" ] ,
65
+ "entries can be read"
66
+ ) ;
67
+ Ok ( ( ) )
68
+ }
69
+
55
70
#[ test]
56
71
fn without_any_additional_settings_all_are_inactive_if_they_have_a_url ( ) -> crate :: Result {
57
72
let module = multi_modules ( ) ?;
Original file line number Diff line number Diff line change @@ -37,3 +37,12 @@ git clone super recursive-clone
37
37
(cd recursive-clone
38
38
git submodule update --init --recursive
39
39
)
40
+
41
+ git clone super not-a-submodule
42
+ (cd not-a-submodule
43
+ cp .gitmodules modules.bak
44
+ git rm submodule
45
+ echo fake > submodule
46
+ mv modules.bak .gitmodules
47
+ git add submodule && git commit -m " no submodule in index and commit, but in configuration"
48
+ )
Original file line number Diff line number Diff line change 1
1
version https://git-lfs.github.com/spec/v1
2
- oid sha256:c961fe67eb7af352064aeae412cabf8b8260782db003ddea7ca251c491c4963e
3
- size 31404
2
+ oid sha256:f1213af1023577c8c59e1a065530785e28ee10e4e04f731597aebc6a63e3dc86
3
+ size 32472
You can’t perform that action at this time.
0 commit comments