@@ -12,6 +12,8 @@ use crate::{
1212 BStr , FullName , Namespace , Reference ,
1313} ;
1414
15+ use gix_path:: relative_path:: RelativePath ;
16+
1517/// An iterator stepping through sorted input of loose references and packed references, preferring loose refs over otherwise
1618/// equivalent packed references.
1719///
@@ -204,9 +206,9 @@ impl Platform<'_> {
204206 ///
205207 /// Prefixes are relative paths with slash-separated components.
206208 // TODO: use `RelativePath` type instead (see #1921), or a trait that helps convert into it.
207- pub fn prefixed < ' a > ( & self , prefix : impl Into < & ' a BStr > ) -> std:: io:: Result < LooseThenPacked < ' _ , ' _ > > {
209+ pub fn prefixed < ' a > ( & self , prefix : & ' a RelativePath ) -> std:: io:: Result < LooseThenPacked < ' _ , ' _ > > {
208210 self . store
209- . iter_prefixed_packed ( prefix. into ( ) , self . packed . as_ref ( ) . map ( |b| & * * * b) )
211+ . iter_prefixed_packed ( prefix, self . packed . as_ref ( ) . map ( |b| & * * * b) )
210212 }
211213}
212214
@@ -291,13 +293,8 @@ impl<'a> IterInfo<'a> {
291293 . peekable ( )
292294 }
293295
294- fn from_prefix (
295- base : & ' a Path ,
296- prefix : impl Into < Cow < ' a , BStr > > ,
297- precompose_unicode : bool ,
298- ) -> std:: io:: Result < Self > {
299- let prefix = prefix. into ( ) ;
300- let prefix_path = gix_path:: from_bstr ( prefix. as_ref ( ) ) ;
296+ fn from_prefix ( base : & ' a Path , prefix : & ' a RelativePath , precompose_unicode : bool ) -> std:: io:: Result < Self > {
297+ let prefix_path = gix_path:: from_bstr ( prefix) ;
301298 if prefix_path. is_absolute ( ) {
302299 return Err ( std:: io:: Error :: new (
303300 std:: io:: ErrorKind :: InvalidInput ,
@@ -326,7 +323,7 @@ impl<'a> IterInfo<'a> {
326323 . to_owned ( ) ;
327324 Ok ( IterInfo :: ComputedIterationRoot {
328325 base,
329- prefix,
326+ prefix : prefix . into ( ) ,
330327 iter_root,
331328 precompose_unicode,
332329 } )
@@ -380,7 +377,7 @@ impl file::Store {
380377 // TODO: use `RelativePath` type instead (see #1921), or a trait that helps convert into it.
381378 pub fn iter_prefixed_packed < ' a , ' s , ' p > (
382379 & ' s self ,
383- prefix : impl Into < & ' a BStr > ,
380+ prefix : & ' a RelativePath ,
384381 packed : Option < & ' p packed:: Buffer > ,
385382 ) -> std:: io:: Result < LooseThenPacked < ' p , ' s > > {
386383 let prefix = prefix. into ( ) ;
@@ -394,8 +391,12 @@ impl file::Store {
394391 self . iter_from_info ( git_dir_info, common_dir_info, packed)
395392 }
396393 Some ( namespace) => {
397- let prefix = namespace. to_owned ( ) . into_namespaced_prefix ( prefix) ;
398- let git_dir_info = IterInfo :: from_prefix ( self . git_dir ( ) , prefix. clone ( ) , self . precompose_unicode ) ?;
394+ let prefix = namespace
395+ . to_owned ( )
396+ . into_namespaced_prefix ( prefix)
397+ . try_into ( )
398+ . expect ( "TODO" ) ;
399+ let git_dir_info = IterInfo :: from_prefix ( self . git_dir ( ) , prefix, self . precompose_unicode ) ?;
399400 let common_dir_info = self
400401 . common_dir ( )
401402 . map ( |base| IterInfo :: from_prefix ( base, prefix, self . precompose_unicode ) )
0 commit comments