Reputation: 43
I using msysgit and TortoiseGit 1.8.15.0 under Windows 7, and then set my start-commit-hook scripts file to './workflow.bat'. the script file content as follows:
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 will show alert box as expected when I commit my code, and then I click 'OK' button, it still show a tortoiseGit commit dialog to me after hook scripts finish. how to prevent the tortoiseGit commit dialog displays when the hook scripts exit with code 1 ?
Upvotes: 2
Views: 973
Reputation: 73536
Pre-commit
hook can block the commit from actualizing by returning non-zero exit code.
Start-commit
hook doesn't even have the log message to analyze because it will be entered by the user later in a subsequent commit dialog. The hook can, however, provide some preset commit message on its own.
Evidently there's no way for Start-commit
hook to block the subsequent dialog. You can ask for this feature to be implemented on their issue tracker though.
Upvotes: 2