Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle: add .external_template(false) to all other libgit2 calls
Merged did:key:z6MkqXhe...W4FR opened 10 months ago

This complements 9d4aa59a125228c4c578a750bc617acaab1f911f.

3 files changed +21 -4 ab62dce6 e30e66e0
modified crates/radicle-cli/src/commands/id.rs
@@ -764,7 +764,12 @@ fn print_diff(
    let current = serde_json::to_string_pretty(&current.doc)?;

    let tmp = tempfile::tempdir()?;
-
    let repo = radicle::git::raw::Repository::init_bare(tmp.path())?;
+
    let repo = radicle::git::raw::Repository::init_opts(
+
        tmp.path(),
+
        radicle::git::raw::RepositoryInitOptions::new()
+
            .external_template(false)
+
            .bare(true),
+
    )?;

    let previous = if let Some(previous) = previous {
        let tree = radicle::git::write_tree(&doc::PATH, previous.as_bytes(), &repo)?;
modified crates/radicle-cob/src/test/storage.rs
@@ -41,7 +41,11 @@ pub struct Storage {
impl Storage {
    pub fn new() -> Self {
        let temp = tempfile::tempdir().unwrap();
-
        let raw = git2::Repository::init(temp.path()).unwrap();
+
        let raw = git2::Repository::init_opts(
+
            temp.path(),
+
            git2::RepositoryInitOptions::new().external_template(false),
+
        )
+
        .unwrap();
        let mut config = raw.config().unwrap();
        config.set_str("user.name", "Terry Pratchett").unwrap();
        config
modified crates/radicle/src/test/fixtures.rs
@@ -89,7 +89,11 @@ where

/// Creates a regular repository at the given path with a couple of commits.
pub fn repository<P: AsRef<Path>>(path: P) -> (git2::Repository, git2::Oid) {
-
    let repo = git2::Repository::init(path).unwrap();
+
    let repo = git2::Repository::init_opts(
+
        path,
+
        git2::RepositoryInitOptions::new().external_template(false),
+
    )
+
    .unwrap();
    let user_name = "anonymous";
    let user_email = "anonymous@radicle.xyz";
    {
@@ -209,7 +213,11 @@ pub mod gen {

    /// Creates a regular repository at the given path with a couple of commits.
    pub fn repository<P: AsRef<Path>>(path: P) -> (git2::Repository, git2::Oid) {
-
        let repo = git2::Repository::init(path).unwrap();
+
        let repo = git2::Repository::init_opts(
+
            path,
+
            git2::RepositoryInitOptions::new().external_template(false),
+
        )
+
        .unwrap();
        let sig = git2::Signature::now(string(6).as_str(), email().as_str()).unwrap();
        let head = git::initial_commit(&repo, &sig).unwrap();
        let tree =