Skip to content

Commit

Permalink
adapt to changes in git-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 9, 2022
1 parent 68dc86f commit 121c93f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gitoxide-core/src/net.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use std::str::FromStr;

pub fn agent() -> &'static str {
concat!("oxide-", env!("CARGO_PKG_VERSION"))
}

#[derive(Eq, PartialEq, Debug)]
pub enum Protocol {
V1,
Expand Down
7 changes: 5 additions & 2 deletions gitoxide-core/src/pack/receive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::{
io,
path::PathBuf,
Expand Down Expand Up @@ -51,7 +52,7 @@ impl<W> protocol::fetch::DelegateBlocking for CloneDelegate<W> {
&mut self,
server: &Capabilities,
arguments: &mut Vec<BString>,
_features: &mut Vec<(&str, Option<&str>)>,
_features: &mut Vec<(&str, Option<Cow<'_, str>>)>,
) -> io::Result<LsRefsAction> {
if server.contains("ls-refs") {
arguments.extend(FILTER.iter().map(|r| format!("ref-prefix {}", r).into()));
Expand All @@ -67,7 +68,7 @@ impl<W> protocol::fetch::DelegateBlocking for CloneDelegate<W> {
&mut self,
version: transport::Protocol,
server: &Capabilities,
_features: &mut Vec<(&str, Option<&str>)>,
_features: &mut Vec<(&str, Option<Cow<'_, str>>)>,
_refs: &[Ref],
) -> io::Result<Action> {
if !self.wanted_refs.is_empty() && !remote_supports_ref_in_want(server) {
Expand Down Expand Up @@ -172,6 +173,7 @@ mod blocking_io {
protocol::credentials::builtin,
progress,
protocol::FetchConnection::TerminateOnSuccessfulCompletion,
crate::net::agent(),
)?;
Ok(())
}
Expand Down Expand Up @@ -245,6 +247,7 @@ mod async_io {
protocol::credentials::builtin,
progress,
protocol::FetchConnection::TerminateOnSuccessfulCompletion,
crate::net::agent(),
))
})
.await?;
Expand Down

0 comments on commit 121c93f

Please sign in to comment.