From 8730ff086a4c04501924e11e9ccf9fa5f35aa808 Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Sun, 12 Oct 2025 15:25:38 +0200 Subject: [PATCH] Import .gitconfig automatically if in ~/Projects --- home/private_dot_config/git/config.tmpl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/home/private_dot_config/git/config.tmpl b/home/private_dot_config/git/config.tmpl index e932987..f51392f 100644 --- a/home/private_dot_config/git/config.tmpl +++ b/home/private_dot_config/git/config.tmpl @@ -17,3 +17,14 @@ ff = true [credential] helper = {{ $credentialHelperPath }} {{- end }} + +{{- $projectsDir := joinPath .chezmoi.homeDir "Projects" }} +{{- if stat $projectsDir }} +{{- $projects := output "find" $projectsDir "-type" "f" "-mindepth" "2" "-maxdepth" "2" "-name" ".gitconfig" | trim | splitList "\n" }} +{{- range $projects }} +{{- if . }} +[includeIf "gitdir:{{ . | dir }}/**/"] +path = {{ . }} +{{- end }} +{{- end }} +{{- end }}