TortoiseGit 钩子脚本无法阻止开始提交

TortoiseGit hook scripts can not prevent start-commit

我在 Windows 7 下使用 msysgit 和 TortoiseGit 1.8.15.0,然后将我的 start-commit-hook 脚本文件设置为 './workflow.bat'。脚本文件内容如下:

echo --------------------------------------------------------------------------- 1>&2
echo Your commit has been blocked because it didn't include a log message. 1>&2
echo Do the commit again, this time with a log message that describes your changes. 1>&2
echo --------------------------------------------------------------------------- 1>&2
exit 1

当我提交我的代码时,TortoiseGit 会按预期显示警告框,然后我单击 'OK' 按钮,它仍然在钩子脚本完成后向我显示一个 tortoiseGit 提交对话框。当挂钩脚本以代码 1 退出时,如何防止 tortoiseGit 提交对话框显示?

Pre-commit 挂钩可以通过返回非零退出代码来阻止提交的实现。

Start-commit 挂钩甚至没有要分析的日志消息,因为它稍后将由用户在后续提交对话框中输入。但是,挂钩可以自己提供一些预设的提交消息。

显然 Start-commit 钩子无法阻止后续对话。不过,您可以要求在 their issue tracker 上实现此功能。