@@ -3,6 +3,7 @@ use crate::pack::receive::protocol::fetch::negotiate;
33use crate :: OutputFormat ;
44use gix:: config:: tree:: Key ;
55use gix:: protocol:: maybe_async;
6+ use gix:: remote:: fetch:: Error ;
67use gix:: DynNestedProgress ;
78pub use gix:: {
89 hash:: ObjectId ,
6465
6566 let agent = gix:: protocol:: agent ( gix:: env:: agent ( ) ) ;
6667 let mut handshake = gix:: protocol:: fetch:: handshake (
67- & mut transport,
68+ & mut transport. inner ,
6869 gix:: protocol:: credentials:: builtin,
6970 vec ! [ ( "agent" . into( ) , Some ( agent. clone( ) ) ) ] ,
7071 & mut progress,
@@ -85,13 +86,22 @@ where
8586 & fetch_refspecs,
8687 gix:: protocol:: fetch:: Context {
8788 handshake : & mut handshake,
88- transport : & mut transport,
89+ transport : & mut transport. inner ,
8990 user_agent : user_agent. clone ( ) ,
9091 trace_packetlines,
9192 } ,
9293 gix:: protocol:: fetch:: refmap:: init:: Options :: default ( ) ,
9394 )
9495 . await ?;
96+
97+ if refmap. mappings . is_empty ( ) && !refmap. remote_refs . is_empty ( ) {
98+ return Err ( Error :: NoMapping {
99+ refspecs : refmap. refspecs . clone ( ) ,
100+ num_remote_refs : refmap. remote_refs . len ( ) ,
101+ }
102+ . into ( ) ) ;
103+ }
104+
95105 let mut negotiate = Negotiate { refmap : & refmap } ;
96106 gix:: protocol:: fetch (
97107 & mut negotiate,
@@ -114,7 +124,7 @@ where
114124 & ctx. should_interrupt ,
115125 gix:: protocol:: fetch:: Context {
116126 handshake : & mut handshake,
117- transport : & mut transport,
127+ transport : & mut transport. inner ,
118128 user_agent,
119129 trace_packetlines,
120130 } ,
@@ -140,10 +150,13 @@ impl gix::protocol::fetch::Negotiate for Negotiate<'_> {
140150 } )
141151 }
142152
143- fn add_wants ( & mut self , arguments : & mut Arguments , _remote_ref_target_known : & [ bool ] ) {
153+ fn add_wants ( & mut self , arguments : & mut Arguments , _remote_ref_target_known : & [ bool ] ) -> bool {
154+ let mut has_want = false ;
144155 for id in self . refmap . mappings . iter ( ) . filter_map ( |m| m. remote . as_id ( ) ) {
145156 arguments. want ( id) ;
157+ has_want = true ;
146158 }
159+ has_want
147160 }
148161
149162 fn one_round (
0 commit comments