Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Run git fetch without any user config
Alexis Sellier committed 3 years ago
commit 0726c553dac48490d44f67716dd398e093b68d3c
parent 258d2d35e4363fdc650fca88f6839fd0ed019458
3 files changed +12 -0
modified radicle-node/src/runtime.rs
@@ -235,6 +235,7 @@ pub mod daemon {
        let child = Command::new("git")
            .env_clear()
            .envs(env::vars().filter(|(k, _)| k == "PATH" || k.starts_with("GIT")))
+
            .envs(radicle::git::env::GIT_RESET)
            .env("GIT_PROTOCOL", "version=2")
            .current_dir(storage)
            .arg("daemon")
modified radicle-node/src/worker.rs
@@ -153,6 +153,7 @@ impl<G: Signer + EcSign + 'static> Worker<G> {
        cmd.current_dir(repo.path())
            .env_clear()
            .envs(env::vars().filter(|(k, _)| k == "PATH" || k.starts_with("GIT_TRACE")))
+
            .envs(git::env::GIT_RESET)
            .args(["-c", "protocol.version=2"])
            .arg("fetch")
            .arg("--verbose");
modified radicle/src/git.rs
@@ -507,6 +507,16 @@ pub mod url {
    }
}

+
/// Git environment variables.
+
pub mod env {
+
    /// Set of environment vars to reset git's configuration to default.
+
    pub const GIT_RESET: [(&str, &str); 3] = [
+
        ("GIT_CONFIG", "/dev/null"),
+
        ("GIT_CONFIG_GLOBAL", "/dev/null"),
+
        ("GIT_CONFIG_NOSYSTEM", "1"),
+
    ];
+
}
+

#[cfg(test)]
mod test {
    use super::*;