Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: I'd be a little more lax with the Git version
✓ CI success Lorenz Leutgeb committed 9 months ago
commit 913071ddfcc3d1e8a8cd65026a203139e418a624
parent 9ea398542c214973596ecfd206f0e161b39f9c29
1 passed (1 total) View logs
3 files changed +13 -7
modified crates/radicle-fetch/src/transport.rs
@@ -324,6 +324,15 @@ impl WantsHaves {
    }
}

-
fn agent_name() -> Result<String, radicle::git::VersionError> {
-
    Ok(format!("git/{}", radicle::git::version()?))
+
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
@@ -173,7 +173,7 @@ where
        keepfile: None,
    };
    let mut negotiate = Negotiate { wants_haves };
-
    let agent = agent_name().expect("git version must be known");
+
    let agent = agent_name();

    let mut pack_out = None;
    let mut handshake = handshake.clone();
modified crates/radicle-fetch/src/transport/ls_refs.rs
@@ -60,10 +60,7 @@ where
                arg.push_str(prefix);
                args.push(arg)
            }
-
            features.push((
-
                "agent",
-
                Some(Cow::Owned(agent_name().expect("git version must be known"))),
-
            ));
+
            features.push(("agent", Some(Cow::Owned(agent_name()))));
            Ok(gix_protocol::ls_refs::Action::Continue)
        },
        progress,