@@ -72,7 +72,6 @@ fn compare_baseline_with_ours() {
72
72
pattern. matches_repo_relative_path (
73
73
value,
74
74
basename_start_pos ( value) ,
75
- None ,
76
75
false , // TODO: does it make sense to pretend it is a dir and see what happens?
77
76
* case,
78
77
)
@@ -112,11 +111,11 @@ fn non_dirs_for_must_be_dir_patterns_are_ignored() {
112
111
) ;
113
112
let path = "hello" ;
114
113
assert ! (
115
- !pattern. matches_repo_relative_path( path, None , None , false /* is-dir */ , Case :: Sensitive ) ,
114
+ !pattern. matches_repo_relative_path( path, None , false /* is-dir */ , Case :: Sensitive ) ,
116
115
"non-dirs never match a dir pattern"
117
116
) ;
118
117
assert ! (
119
- pattern. matches_repo_relative_path( path, None , None , true /* is-dir */ , Case :: Sensitive ) ,
118
+ pattern. matches_repo_relative_path( path, None , true /* is-dir */ , Case :: Sensitive ) ,
120
119
"dirs can match a dir pattern with the normal rules"
121
120
) ;
122
121
}
@@ -146,13 +145,6 @@ fn basename_matches_from_end() {
146
145
assert ! ( !match_file( pat, "barfoo" , Case :: Sensitive ) ) ;
147
146
}
148
147
149
- #[ test]
150
- #[ should_panic]
151
- fn base_path_must_match_or_panic_occours_in_debug_mode ( ) {
152
- let pat = pat ( "foo" ) ;
153
- assert ! ( match_file_with_base( & pat, "other/FoO" , "base/" , Case :: Fold ) ) ;
154
- }
155
-
156
148
#[ test]
157
149
fn absolute_basename_matches_only_from_beginning ( ) {
158
150
let pat = & pat ( "/foo" ) ;
@@ -161,13 +153,6 @@ fn absolute_basename_matches_only_from_beginning() {
161
153
assert ! ( match_file( pat, "foo" , Case :: Sensitive ) ) ;
162
154
assert ! ( !match_file( pat, "Foo" , Case :: Sensitive ) ) ;
163
155
assert ! ( !match_file( pat, "bar/foo" , Case :: Sensitive ) ) ;
164
-
165
- let base = "base/" ;
166
- assert ! ( match_file_with_base( pat, "base/FoO" , base, Case :: Fold ) ) ;
167
- assert ! ( !match_file_with_base( pat, "base/bar/Foo" , base, Case :: Fold ) ) ;
168
- assert ! ( match_file_with_base( pat, "base/foo" , base, Case :: Sensitive ) ) ;
169
- assert ! ( !match_file_with_base( pat, "base/Foo" , base, Case :: Sensitive ) ) ;
170
- assert ! ( !match_file_with_base( pat, "base/bar/foo" , base, Case :: Sensitive ) ) ;
171
156
}
172
157
173
158
#[ test]
@@ -178,13 +163,6 @@ fn absolute_path_matches_only_from_beginning() {
178
163
assert ! ( !match_file( pat, "foo" , Case :: Sensitive ) ) ;
179
164
assert ! ( match_file( pat, "bar/foo" , Case :: Sensitive ) ) ;
180
165
assert ! ( !match_file( pat, "bar/Foo" , Case :: Sensitive ) ) ;
181
-
182
- let base = "base/" ;
183
- assert ! ( !match_file_with_base( pat, "base/FoO" , base, Case :: Fold ) ) ;
184
- assert ! ( match_file_with_base( pat, "base/bar/Foo" , base, Case :: Fold ) ) ;
185
- assert ! ( !match_file_with_base( pat, "base/foo" , base, Case :: Sensitive ) ) ;
186
- assert ! ( match_file_with_base( pat, "base/bar/foo" , base, Case :: Sensitive ) ) ;
187
- assert ! ( !match_file_with_base( pat, "base/bar/Foo" , base, Case :: Sensitive ) ) ;
188
166
}
189
167
190
168
#[ test]
@@ -193,22 +171,13 @@ fn absolute_path_with_recursive_glob_detects_mismatches_quickly() {
193
171
assert ! ( !match_file( pat, "FoO" , Case :: Fold ) ) ;
194
172
assert ! ( !match_file( pat, "bar/Fooo" , Case :: Fold ) ) ;
195
173
assert ! ( !match_file( pat, "baz/bar/Foo" , Case :: Fold ) ) ;
196
-
197
- let base = "base/" ;
198
- assert ! ( !match_file_with_base( pat, "base/FoO" , base, Case :: Fold ) ) ;
199
- assert ! ( !match_file_with_base( pat, "base/bar/Fooo" , base, Case :: Fold ) ) ;
200
- assert ! ( !match_file_with_base( pat, "base/baz/bar/foo" , base, Case :: Sensitive ) ) ;
201
174
}
202
175
203
176
#[ test]
204
177
fn absolute_path_with_recursive_glob_can_do_case_insensitive_prefix_search ( ) {
205
178
let pat = & pat ( "/bar/foo/**" ) ;
206
179
assert ! ( !match_file( pat, "bar/Foo/match" , Case :: Sensitive ) ) ;
207
180
assert ! ( match_file( pat, "bar/Foo/match" , Case :: Fold ) ) ;
208
-
209
- let base = "base/" ;
210
- assert ! ( !match_file_with_base( pat, "base/bar/Foo/match" , base, Case :: Sensitive ) ) ;
211
- assert ! ( match_file_with_base( pat, "base/bar/Foo/match" , base, Case :: Fold ) ) ;
212
181
}
213
182
214
183
#[ test]
@@ -303,18 +272,7 @@ fn match_file<'a>(pattern: &git_glob::Pattern, path: impl Into<&'a BStr>, case:
303
272
304
273
fn match_path < ' a > ( pattern : & git_glob:: Pattern , path : impl Into < & ' a BStr > , is_dir : bool , case : Case ) -> bool {
305
274
let path = path. into ( ) ;
306
- pattern. matches_repo_relative_path ( path, basename_start_pos ( path) , None , is_dir, case)
307
- }
308
-
309
- fn match_file_with_base < ' a > (
310
- pattern : & git_glob:: Pattern ,
311
- path : impl Into < & ' a BStr > ,
312
- base : impl Into < & ' a BStr > ,
313
- case : Case ,
314
- ) -> bool {
315
- let path = path. into ( ) ;
316
- let base = base. into ( ) ;
317
- pattern. matches_repo_relative_path ( path, basename_start_pos ( path) , Some ( base) , false , case)
275
+ pattern. matches_repo_relative_path ( path, basename_start_pos ( path) , is_dir, case)
318
276
}
319
277
320
278
fn basename_start_pos ( value : & BStr ) -> Option < usize > {
0 commit comments