History

adapt to changes in `git-protocol`

Sebastian Thiel committed 3 years ago

Commit bd708471 parent 09070a74 files · +11 −18Browse files

Unified · Split

4 files
  1. git-repository/src/config/cache/access.rs +1 −1
  2. git-repository/src/remote/connection/fetch/mod.rs +2 −2
  3. git-repository/src/remote/connection/fetch/receive_pack.rs +4 −10
  4. git-repository/src/remote/connection/ref_map.rs +4 −5
git-repository/src/config/cache/access.rs+1−1
@@ -55,7 +55,7 @@ impl Cache { · 54 unmodified lines
55 .unwrap_or_else(|| crate::env::agent().into())55 .unwrap_or_else(|| crate::env::agent().into())
56 })56 })
57 .to_owned();57 .to_owned();
58 ("agent", Some(git_protocol::fetch::agent(agent).into()))58 ("agent", Some(git_protocol::agent(agent).into()))
59 }59 }
60 60
61 pub(crate) fn personas(&self) -> &identity::Personas {61 pub(crate) fn personas(&self) -> &identity::Personas {
git-repository/src/remote/connection/fetch/mod.rs+2−2
@@ -187,14 +187,14 @@ where · 186 unmodified lines
187 // Right now we block the executor by forcing this communication, but that only187 // Right now we block the executor by forcing this communication, but that only
188 // happens if the user didn't actually try to receive a pack, which consumes the188 // happens if the user didn't actually try to receive a pack, which consumes the
189 // connection in an async context.189 // connection in an async context.
190 git_protocol::futures_lite::future::block_on(git_protocol::fetch::indicate_end_of_interaction(190 git_protocol::futures_lite::future::block_on(git_protocol::indicate_end_of_interaction(
191 &mut con.transport,191 &mut con.transport,
192 ))192 ))
193 .ok();193 .ok();
194 }194 }
195 #[cfg(not(feature = "async-network-client"))]195 #[cfg(not(feature = "async-network-client"))]
196 {196 {
197 git_protocol::fetch::indicate_end_of_interaction(&mut con.transport).ok();197 git_protocol::indicate_end_of_interaction(&mut con.transport).ok();
198 }198 }
199 }199 }
200 }200 }
git-repository/src/remote/connection/fetch/receive_pack.rs+4−10
@@ -68,7 +68,7 @@ where · 67 unmodified lines
68 let handshake = &self.ref_map.handshake;68 let handshake = &self.ref_map.handshake;
69 let protocol_version = handshake.server_protocol_version;69 let protocol_version = handshake.server_protocol_version;
70 70
71 let fetch = git_protocol::fetch::Command::Fetch;71 let fetch = git_protocol::Command::Fetch;
72 let progress = &mut con.progress;72 let progress = &mut con.progress;
73 let repo = con.remote.repo;73 let repo = con.remote.repo;
74 let fetch_features = {74 let fetch_features = {
@@ -103,9 +103,7 @@ where · 28 unmodified lines
103 previous_response.as_ref(),103 previous_response.as_ref(),
104 ) {104 ) {
105 Ok(_) if arguments.is_empty() => {105 Ok(_) if arguments.is_empty() => {
106 git_protocol::fetch::indicate_end_of_interaction(&mut con.transport)106 git_protocol::indicate_end_of_interaction(&mut con.transport).await.ok();
107 .await
108 .ok();
109 return Ok(Outcome {107 return Ok(Outcome {
110 ref_map: std::mem::take(&mut self.ref_map),108 ref_map: std::mem::take(&mut self.ref_map),
111 status: Status::NoChange,109 status: Status::NoChange,
@@ -113,9 +111,7 @@ where · 1 unmodified line
113 }111 }
114 Ok(is_done) => is_done,112 Ok(is_done) => is_done,
115 Err(err) => {113 Err(err) => {
116 git_protocol::fetch::indicate_end_of_interaction(&mut con.transport)114 git_protocol::indicate_end_of_interaction(&mut con.transport).await.ok();
117 .await
118 .ok();
119 return Err(err.into());115 return Err(err.into());
120 }116 }
121 };117 };
@@ -169,9 +165,7 @@ where · 47 unmodified lines
169 };165 };
170 166
171 if matches!(protocol_version, git_protocol::transport::Protocol::V2) {167 if matches!(protocol_version, git_protocol::transport::Protocol::V2) {
172 git_protocol::fetch::indicate_end_of_interaction(&mut con.transport)168 git_protocol::indicate_end_of_interaction(&mut con.transport).await.ok();
173 .await
174 .ok();
175 }169 }
176 170
177 let update_refs = refs::update(171 let update_refs = refs::update(
git-repository/src/remote/connection/ref_map.rs+4−5
@@ -25,7 +25,7 @@ pub enum Error { · 24 unmodified lines
25 #[error("The object format {format:?} as used by the remote is unsupported")]25 #[error("The object format {format:?} as used by the remote is unsupported")]
26 UnknownObjectFormat { format: BString },26 UnknownObjectFormat { format: BString },
27 #[error(transparent)]27 #[error(transparent)]
28 ListRefs(#[from] git_protocol::fetch::refs::Error),28 ListRefs(#[from] git_protocol::ls_refs::Error),
29 #[error(transparent)]29 #[error(transparent)]
30 Transport(#[from] git_protocol::transport::client::Error),30 Transport(#[from] git_protocol::transport::client::Error),
31 #[error(transparent)]31 #[error(transparent)]
@@ -80,7 +80,7 @@ where · 48 unmodified lines
80 #[git_protocol::maybe_async::maybe_async]80 #[git_protocol::maybe_async::maybe_async]
81 pub async fn ref_map(mut self, options: Options) -> Result<fetch::RefMap, Error> {81 pub async fn ref_map(mut self, options: Options) -> Result<fetch::RefMap, Error> {
82 let res = self.ref_map_inner(options).await;82 let res = self.ref_map_inner(options).await;
83 git_protocol::fetch::indicate_end_of_interaction(&mut self.transport)83 git_protocol::indicate_end_of_interaction(&mut self.transport)
84 .await84 .await
85 .ok();85 .ok();
86 res86 res
@@ -181,9 +181,8 @@ where · 94 unmodified lines
181 None => {181 None => {
182 let specs = &self.remote.fetch_specs;182 let specs = &self.remote.fetch_specs;
183 let agent_feature = self.remote.repo.config.user_agent_tuple();183 let agent_feature = self.remote.repo.config.user_agent_tuple();
184 git_protocol::fetch::refs(184 git_protocol::ls_refs(
185 &mut self.transport,185 &mut self.transport,
186 outcome.server_protocol_version,
187 &outcome.capabilities,186 &outcome.capabilities,
188 move |_capabilities, arguments, features| {187 move |_capabilities, arguments, features| {
189 features.push(agent_feature);188 features.push(agent_feature);
@@ -201,7 +200,7 @@ where · 11 unmodified lines
201 }200 }
202 }201 }
203 }202 }
204 Ok(git_protocol::fetch::delegate::LsRefsAction::Continue)203 Ok(git_protocol::ls_refs::Action::Continue)
205 },204 },
206 &mut self.progress,205 &mut self.progress,
207 )206 )