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> { fn agent_name() -> String {
Ok(format!( let version = match radicle::git::version() {
"git/{}", Ok(version) => version,
radicle::git::version().map_err(io_other)? 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, keepfile: None,
}; };
let mut negotiate = Negotiate { wants_haves }; 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 pack_out = None;
let mut handshake = handshake.clone(); let mut handshake = handshake.clone();

View File

@ -60,7 +60,7 @@ where
arg.push_str(prefix); arg.push_str(prefix);
args.push(arg) 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) Ok(gix_protocol::ls_refs::Action::Continue)
}, },
progress, progress,