but commit in 0.22.x creates commits without running any Git commit hooks, and the flag that controlled them is gone. In 0.21.x the same command ran pre-commit, commit-msg and post-commit, and -n/--no-hooks (alias --no-verify) turned them off. The 0.22.0 to 0.22.3 release notes do not mention the change, so a repository that relies on a pre-commit check now commits through but with no check and no warning.
Steps to reproduce (0.22.3, macOS)
- In a GitButler-managed repository, add an executable
.git/hooks/pre-commit,commit-msgandpost-commit, each of which appends a line to a log file and exits 0. - Make a change and run
but commit -m "test" <change-id>. - The commit is created and the log stays empty.
- Control:
git hook run commit-msg -- <msg-file>in the same repository does append to the log, so the hooks themselves are reachable.
Expected: but commit runs the commit hooks, as 0.21.x did and as the desktop app does when "Run Git hooks" is enabled, with a flag to skip them.
Actual: no hook runs, and but commit --help lists no hook option.
Source references
crates/but/src/command/legacy/commit.rsatrelease/0.21.2callspre_commit_hook_diffspecs,message_hookandpost_commit_hookbehindif !no_hooks. Atrelease/0.22.0andrelease/0.22.3the file has no hook references.crates/but/src/args/commit.rsatrelease/0.21.2defines#[clap(short = 'n', long = "no-hooks", alias = "no-verify")]. Atrelease/0.22.3the flag is absent.- The change landed with #14970.
but pushstill runs pre-push hooks and still has--no-hooks, so the two commands now behave differently.
If dropping commit hooks from the CLI was intentional, a line in the release notes and in but commit --help would help anyone relying on them.
Would love to take on this one @estib-vega