11use anyhow:: { bail, Result } ;
2+ use git:: bstr:: { BStr , BString } ;
23use git_repository as git;
3- use git_repository:: bstr:: BString ;
44
55use crate :: OutputFormat ;
66
77pub fn list (
88 repo : git:: Repository ,
9- filters : Vec < String > ,
9+ filters : Vec < BString > ,
1010 overrides : Vec < BString > ,
1111 format : OutputFormat ,
1212 mut out : impl std:: io:: Write ,
@@ -52,18 +52,18 @@ pub fn list(
5252
5353struct Filter {
5454 name : String ,
55- subsection : Option < String > ,
55+ subsection : Option < BString > ,
5656}
5757
5858impl Filter {
59- fn new ( input : String ) -> Self {
60- match git:: config:: parse:: key ( & input) {
59+ fn new ( input : BString ) -> Self {
60+ match git:: config:: parse:: key ( < _ as AsRef < BStr > > :: as_ref ( & input) ) {
6161 Some ( key) => Filter {
6262 name : key. section_name . into ( ) ,
6363 subsection : key. subsection_name . map ( ToOwned :: to_owned) ,
6464 } ,
6565 None => Filter {
66- name : input,
66+ name : input. to_string ( ) ,
6767 subsection : None ,
6868 } ,
6969 }
@@ -77,7 +77,7 @@ impl Filter {
7777 }
7878 match ( self . subsection . as_deref ( ) , section. header ( ) . subsection_name ( ) ) {
7979 ( Some ( filter) , Some ( name) ) => {
80- if !git:: glob:: wildmatch ( filter. as_bytes ( ) . into ( ) , name, ignore_case) {
80+ if !git:: glob:: wildmatch ( filter. as_slice ( ) . into ( ) , name, ignore_case) {
8181 return false ;
8282 }
8383 }
0 commit comments