Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle-fetch: Fallback to known version
Lorenz Leutgeb committed 8 months ago
commit d2517c5004e0d442a365ae66b58796cbac41a926
parent a670b6e668761ea5893b7d343b4515b888712f14
3 files changed +13 -7
modified crates/radicle-fetch/src/transport.rs
@@ -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}")
}
modified crates/radicle-fetch/src/transport/fetch.rs
@@ -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();
modified crates/radicle-fetch/src/transport/ls_refs.rs
@@ -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,