feat(install): ask the gitflow push mode at install, fixed hooksPath, identity into gitconfig

gitconfig template: [gitflow] autopush = @AUTOPUSH@ (exact true/false, the
hooks fail closed on anything else) and a fixed core.hooksPath =
~/.claude/githooks (created by `make link` in claude-config, git expands ~).

install.sh: resolve_autopush at the identity step. A true/false already in
~/.gitconfig wins silently, else DOTFILES_GITFLOW_AUTOPUSH (any other value
aborts before a file is touched), else a prompt that re-asks until the
answer is exactly true or false (Enter = true), else true. render_gitconfig
refuses to write when the mode is not a boolean or @AUTOPUSH@ survives.

Fix: deploy_gitconfig received the repo bashrc template, so every install
wrote `name = @USER@` / `email = @EMAIL@`. It now takes the resolved
identity directly. patsub_replacement is turned off so an `&` in a name is
not expanded on bash >= 5.2.
This commit is contained in:
bchanot
2026-10-07 18:22:34 +02:00
parent 79554585c8
commit 9901ec5da0
3 changed files with 83 additions and 18 deletions
+10 -4
View File
@@ -1,10 +1,14 @@
# Template for the user-scope ~/.gitconfig, rendered by install.sh.
# Git never expands $VARS: @USER@ and @EMAIL@ are replaced at install
# time with the USER and EMAIL exported by the deployed bashrc.
# A repo .git/config still overrides these values for that repo.
# Template for the user-scope ~/.gitconfig, rendered by install.sh. Git never
# expands $VARS, so the identity and the gitflow push mode are placeholders
# filled at install time with the installer's answers. A repo .git/config
# still overrides these values for that repo.
[user]
name = @USER@
email = @EMAIL@
[gitflow]
# Push mode of the gitflow hooks: false = manual, you run `git push`;
# true = every commit and merge is pushed. Exact true/false only (fail-closed).
autopush = @AUTOPUSH@
[push]
default = current
[color]
@@ -15,6 +19,8 @@
editor = vim
pager = delta
excludesfile = ~/.gitignore
# gitflow hooks (created by `make link` in claude-config); git expands ~ itself.
hooksPath = ~/.claude/githooks
[advice]
detachedHead = false
[merge]