File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ serde_json = { version = "1.0", features = ["preserve_order"] }
3838anyhow = " 1.0.65"
3939thiserror = " 1.0.35"
4040linked-hash-map = " 0.5"
41- globset = " 0.4.8 "
41+ globset = " 0.4.14 "
4242commands = " 0.0.5"
4343env_logger = " 0.10"
4444log = { version = " ~0.4" , features = [" std" ] }
Original file line number Diff line number Diff line change 11pub mod patch_cli;
22
3- use globset:: Glob ;
43use std:: fs:: File ;
54use std:: io:: { Read , Write } ;
65use std:: path:: { Path , PathBuf } ;
@@ -248,19 +247,23 @@ fn matchname(name: &str, spec: &str) -> bool {
248247 matchsubspec ( name, spec) . is_some ( )
249248}
250249
250+ fn newglob ( spec : & str ) -> globset:: GlobMatcher {
251+ globset:: Glob :: new ( spec) . unwrap ( ) . compile_matcher ( )
252+ }
253+
251254/// If a name matches a specification, return the first sub-specification that it matches
252255fn matchsubspec < ' a > ( name : & str , spec : & ' a str ) -> Option < & ' a str > {
253256 if spec. starts_with ( '_' ) {
254257 return None ;
255258 }
256259 if spec. contains ( '{' ) {
257- let glob = Glob :: new ( spec) . unwrap ( ) . compile_matcher ( ) ;
260+ let glob = newglob ( spec) ;
258261 if glob. is_match ( name) {
259262 return Some ( spec) ;
260263 }
261264 } else {
262265 for subspec in spec. split ( ',' ) {
263- let glob = Glob :: new ( subspec) . unwrap ( ) . compile_matcher ( ) ;
266+ let glob = newglob ( subspec) ;
264267 if glob. is_match ( name) {
265268 return Some ( subspec) ;
266269 }
You can’t perform that action at this time.
0 commit comments