radicle: add .external_template(false) to all other libgit2 calls

This complements 9d4aa59a12.
This commit is contained in:
Jakob Kirsch 2025-06-14 00:18:48 +02:00
parent ab62dce683
commit e30e66e009
No known key found for this signature in database
3 changed files with 21 additions and 4 deletions

View File

@ -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)?;

View File

@ -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

View File

@ -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 =