@@ -58,7 +58,11 @@ pub(crate) mod function {
5858 impl < ' a > LsRefsCommand < ' a > {
5959 /// Build a command to list refs from the given server `capabilities`,
6060 /// using `agent` information to identify ourselves.
61- pub fn new ( capabilities : & ' a Capabilities , agent : ( & ' static str , Option < Cow < ' static , str > > ) ) -> Self {
61+ pub fn new (
62+ prefix_refspecs : Option < & [ gix_refspec:: RefSpec ] > ,
63+ capabilities : & ' a Capabilities ,
64+ agent : ( & ' static str , Option < Cow < ' static , str > > ) ,
65+ ) -> Self {
6266 let _span =
6367 gix_features:: trace:: detail!( "gix_protocol::LsRefsCommand::new()" , capabilities = ?capabilities) ;
6468 let ls_refs = Command :: LsRefs ;
@@ -73,6 +77,21 @@ pub(crate) mod function {
7377 arguments. push ( "unborn" . into ( ) ) ;
7478 }
7579
80+ if let Some ( refspecs) = prefix_refspecs {
81+ let mut seen = HashSet :: new ( ) ;
82+ for spec in refspecs {
83+ let spec = spec. to_ref ( ) ;
84+ if seen. insert ( spec. instruction ( ) ) {
85+ let mut prefixes = Vec :: with_capacity ( 1 ) ;
86+ spec. expand_prefixes ( & mut prefixes) ;
87+ for mut prefix in prefixes {
88+ prefix. insert_str ( 0 , "ref-prefix " ) ;
89+ arguments. push ( prefix) ;
90+ }
91+ }
92+ }
93+ }
94+
7695 Self {
7796 capabilities,
7897 features,
@@ -114,20 +133,5 @@ pub(crate) mod function {
114133 . await ?;
115134 Ok ( from_v2_refs ( & mut remote_refs) . await ?)
116135 }
117-
118- pub ( crate ) fn push_prefix_arguments ( & mut self , all_refspecs : & [ gix_refspec:: RefSpec ] ) {
119- let mut seen = HashSet :: new ( ) ;
120- for spec in all_refspecs {
121- let spec = spec. to_ref ( ) ;
122- if seen. insert ( spec. instruction ( ) ) {
123- let mut prefixes = Vec :: with_capacity ( 1 ) ;
124- spec. expand_prefixes ( & mut prefixes) ;
125- for mut prefix in prefixes {
126- prefix. insert_str ( 0 , "ref-prefix " ) ;
127- self . arguments . push ( prefix) ;
128- }
129- }
130- }
131- }
132136 }
133137}
0 commit comments