From e30e66e009393ee4b25692581a37f42320725085 Mon Sep 17 00:00:00 2001 From: Jakob Kirsch Date: Sat, 14 Jun 2025 00:18:48 +0200 Subject: [PATCH] radicle: add .external_template(false) to all other libgit2 calls This complements 9d4aa59a125228c4c578a750bc617acaab1f911f. --- crates/radicle-cli/src/commands/id.rs | 7 ++++++- crates/radicle-cob/src/test/storage.rs | 6 +++++- crates/radicle/src/test/fixtures.rs | 12 ++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/radicle-cli/src/commands/id.rs b/crates/radicle-cli/src/commands/id.rs index 9625cbdb..3a0f4dc5 100644 --- a/crates/radicle-cli/src/commands/id.rs +++ b/crates/radicle-cli/src/commands/id.rs @@ -764,7 +764,12 @@ fn print_diff( let current = serde_json::to_string_pretty(¤t.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)?; diff --git a/crates/radicle-cob/src/test/storage.rs b/crates/radicle-cob/src/test/storage.rs index 887e131e..f0e1a00c 100644 --- a/crates/radicle-cob/src/test/storage.rs +++ b/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 diff --git a/crates/radicle/src/test/fixtures.rs b/crates/radicle/src/test/fixtures.rs index 34d744d5..6b046d1b 100644 --- a/crates/radicle/src/test/fixtures.rs +++ b/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>(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>(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 =