File tree Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,11 @@ impl IsActivePlatform {
52
52
if let Some ( val) = config. boolean ( "submodule" , Some ( name) , "active" ) . transpose ( ) ? {
53
53
return Ok ( val) ;
54
54
} ;
55
- if let Some ( val) = self
56
- . search
57
- . as_mut ( )
58
- . and_then ( |search| search. pattern_matching_relative_path ( name, Some ( true ) , attributes) )
59
- . map ( |m| !m. is_excluded ( ) )
60
- {
55
+ if let Some ( val) = self . search . as_mut ( ) . map ( |search| {
56
+ search
57
+ . pattern_matching_relative_path ( name, Some ( true ) , attributes)
58
+ . map_or ( false , |m| !m. is_excluded ( ) )
59
+ } ) {
61
60
return Ok ( val) ;
62
61
}
63
62
Ok ( match modules. url ( name) {
Original file line number Diff line number Diff line change @@ -113,6 +113,40 @@ mod is_active_platform {
113
113
) ;
114
114
Ok ( ( ) )
115
115
}
116
+
117
+ #[ test]
118
+ fn pathspecs_matter_even_if_they_do_not_match ( ) -> crate :: Result {
119
+ let module = multi_modules ( ) ?;
120
+ assert_eq ! (
121
+ assume_valid_active_state(
122
+ & module,
123
+ & gix_config:: File :: from_str( "[submodule]\n active = submodule " ) ?,
124
+ Default :: default ( )
125
+ ) ?,
126
+ & [
127
+ ( "submodule" , true ) ,
128
+ ( "a/b" , false ) ,
129
+ ( ".a/..c" , false ) ,
130
+ ( "a/d\\ " , false ) ,
131
+ ( "a\\ e" , false )
132
+ ]
133
+ ) ;
134
+ assert_eq ! (
135
+ assume_valid_active_state(
136
+ & module,
137
+ & gix_config:: File :: from_str( "[submodule]\n active = :!submodule " ) ?,
138
+ Default :: default ( )
139
+ ) ?,
140
+ & [
141
+ ( "submodule" , false ) ,
142
+ ( "a/b" , true ) ,
143
+ ( ".a/..c" , true ) ,
144
+ ( "a/d\\ " , true ) ,
145
+ ( "a\\ e" , true )
146
+ ]
147
+ ) ;
148
+ Ok ( ( ) )
149
+ }
116
150
}
117
151
118
152
mod path {
You can’t perform that action at this time.
0 commit comments