From 431b1fb5a585b3cb04ed4133076c04b9fc9a6948 Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 15 Feb 2026 14:23:39 -0600 Subject: [PATCH] Remove gitconfig template and implement git configuration directly in InitCommand - Deleted the gitconfig.txt template file from the project templates. - Updated the InitCommand to set git configuration options directly using the `git config` command, enhancing the initialization process by eliminating the need for a separate configuration file. These changes streamline the git initialization process and improve the overall setup experience. --- assets/project-templates/place/gitconfig.txt | 5 ----- src/cli/init.rs | 22 +++++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) delete mode 100644 assets/project-templates/place/gitconfig.txt diff --git a/assets/project-templates/place/gitconfig.txt b/assets/project-templates/place/gitconfig.txt deleted file mode 100644 index 411fd9ec..00000000 --- a/assets/project-templates/place/gitconfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -[core] - autocrlf = false - excludesFile = ~/.gitignore - eol = lf - safecrlf = false diff --git a/src/cli/init.rs b/src/cli/init.rs index 8a46a382..1fa25e58 100644 --- a/src/cli/init.rs +++ b/src/cli/init.rs @@ -18,7 +18,6 @@ use memofs::{InMemoryFs, Vfs, VfsSnapshot}; use super::resolve_path; const GIT_IGNORE_PLACEHOLDER: &str = "gitignore.txt"; -const GIT_CONFIG_PLACEHOLDER: &str = "gitconfig.txt"; static TEMPLATE_BINCODE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/templates.bincode")); @@ -107,12 +106,6 @@ impl InitCommand { } else { path.set_file_name(".gitignore"); } - } else if file_stem == GIT_CONFIG_PLACEHOLDER { - if self.skip_git { - continue; - } else { - path.set_file_name(".gitconfig"); - } } } write_if_not_exists( @@ -133,6 +126,21 @@ impl InitCommand { if !status.success() { bail!("git init failed: status code {:?}", status.code()); } + + for (key, value) in [ + ("core.autocrlf", "false"), + ("core.eol", "lf"), + ("core.safecrlf", "false"), + ] { + let _ = Command::new("git") + .args(["config", "--local", key, value]) + .current_dir(&base_path) + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status(); + } + true } else { !self.skip_git