radicle-fetch: Fallback to known version

There's a good chance that gix can just keep going in this case.
This commit is contained in:
Lorenz Leutgeb 2025-08-22 11:56:15 +02:00
parent a670b6e668
commit d2517c5004
3 changed files with 13 additions and 7 deletions

View File

@ -327,9 +327,15 @@ impl WantsHaves {
}
}
fn agent_name() -> io::Result<String> {
Ok(format!(
"git/{}",
radicle::git::version().map_err(io_other)?
))
fn agent_name() -> String {
let version = match radicle::git::version() {
Ok(version) => version,
Err(err) => {
use radicle::git::VERSION_REQUIRED;
log::warn!(target: "fetch", "The git version could not be determined: {err}");
log::warn!(target: "fetch", "Pretending that we are on git version {VERSION_REQUIRED}.");
VERSION_REQUIRED
}
};
format!("git/{version}")
}

View File

@ -174,7 +174,7 @@ where
keepfile: None,
};
let mut negotiate = Negotiate { wants_haves };
let agent = agent_name().map_err(Error::ReadRemainingBytes)?;
let agent = agent_name();
let mut pack_out = None;
let mut handshake = handshake.clone();

View File

@ -60,7 +60,7 @@ where
arg.push_str(prefix);
args.push(arg)
}
features.push(("agent", Some(Cow::Owned(agent_name()?))));
features.push(("agent", Some(Cow::Owned(agent_name()))));
Ok(gix_protocol::ls_refs::Action::Continue)
},
progress,