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.
This commit is contained in:
Joe 2026-02-15 14:23:39 -06:00
parent d05ad92c84
commit 431b1fb5a5
2 changed files with 15 additions and 12 deletions

View file

@ -1,5 +0,0 @@
[core]
autocrlf = false
excludesFile = ~/.gitignore
eol = lf
safecrlf = false

View file

@ -18,7 +18,6 @@ use memofs::{InMemoryFs, Vfs, VfsSnapshot};
use super::resolve_path; use super::resolve_path;
const GIT_IGNORE_PLACEHOLDER: &str = "gitignore.txt"; 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")); static TEMPLATE_BINCODE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/templates.bincode"));
@ -107,12 +106,6 @@ impl InitCommand {
} else { } else {
path.set_file_name(".gitignore"); 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( write_if_not_exists(
@ -133,6 +126,21 @@ impl InitCommand {
if !status.success() { if !status.success() {
bail!("git init failed: status code {:?}", status.code()); 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 true
} else { } else {
!self.skip_git !self.skip_git