autoPush not prompting for commit message
lakkeger opened this issue · comments
Describe the bug
Hi,
Recently started to use chezmoi, great project, loving it 💯🏅 However it seems the config behaviours are not always complying to the docs as autoPush implies autoCommit and autoCommit allows you to add commitMessageTemplate, which allows you to add prompt for a commit message. However this is not the case.
To reproduce
Use the below config.
[git]
autoPush = true
commitMessageTemplate = "{{ promptString \"Commit message\" }}"
Run chezmoi edit .mydotfile
, add your changes and it will push the commit without any options to add the message.
Expected behavior
Expected behavior is to be able to add commit messages when you imply the same behaviour as autoCommit.
Output of command with the --verbose
flag
$ chezmoi edit .mydotfile
[main daf6ef8] Add .mydotfile
1 file changed, 31 insertions(+)
create mode 100644 private_dot_mydotfile.tmpl
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 547 bytes | 547.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:lakkeger/dotfiles.git
c705ce4..daf6ef8 main -> main
I tried to replicate this in #3746 but was not able to do so.
What is the output of chezmoi doctor
?
Closing due to inactivity.
Hi @twpayne,
Sorry for the inactivity. See my chezmoi doctor
output:
RESULT CHECK MESSAGE
ok version v2.48.1, commit Homebrew, built at 2024-05-12T18:52:40Z, built by Homebrew
ok latest-version v2.48.1
ok os-arch darwin/arm64
ok uname Darwin lakkeger-MacBook-Pro.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64
ok go-version go1.22.3 (gc)
ok executable /opt/homebrew/bin/chezmoi
ok upgrade-method brew-upgrade
ok config-file ~/.config/chezmoi/chezmoi.toml, last modified 2024-05-02T09:07:33+02:00
ok source-dir ~/.local/share/chezmoi is a git working tree (clean)
ok suspicious-entries no suspicious entries
ok working-tree ~/.local/share/chezmoi is a git working tree (clean)
ok dest-dir ~ is a directory
ok umask 022
ok cd-command found /bin/zsh
ok cd-args /bin/zsh
info diff-command not set
ok edit-command found /opt/homebrew/bin/code
ok edit-args code --wait
ok git-command found /opt/homebrew/bin/git, version 2.45.0
ok merge-command found /usr/bin/vimdiff
ok shell-command found /bin/zsh
ok shell-args /bin/zsh
ok age-command found /opt/homebrew/bin/age, version 1.1.1
ok gpg-command found /opt/homebrew/bin/gpg, version 2.4.5
info pinentry-command not set
info 1password-command op not found in $PATH
ok bitwarden-command found /opt/homebrew/bin/bw, version 2024.4.0
info bitwarden-secrets-command bws not found in $PATH
info dashlane-command dcli not found in $PATH
info doppler-command doppler not found in $PATH
info gopass-command gopass not found in $PATH
info keepassxc-command keepassxc-cli not found in $PATH
info keepassxc-db not set
info keeper-command keeper not found in $PATH
info lastpass-command lpass not found in $PATH
info pass-command pass not found in $PATH
info passhole-command ph not found in $PATH
info rbw-command rbw not found in $PATH
ok vault-command found /opt/homebrew/bin/vault, version 1.14.4
info vlt-command vlt not found in $PATH
info secret-command not set
The config template is pretty much the same as before:
[git]
autoPush = true
commitMessageTemplate = "{{ promptString \"Commit message\" }}"
[add]
secrets = "error"
BEFORE it was a user error as I had an old version of the config in place.
AFTER I found I got an error as it turns out the documentation mentions editing config and not the template, hence the template throws error if you try to add the above config. To work this around one must escape the commit message part as it shows below and then it works as expected:
...
commitMessageTemplate = {{`"{{ promptString \"Commit message\" }}"`}}
...
Perhaps it worth mentioning this in the docs, but other than that all seems to be in order now.