2

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 ?

1 Answers1

2

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.

MrTux
  • 32,350
  • 30
  • 109
  • 146
wOxxOm
  • 65,848
  • 11
  • 132
  • 136
  • Just FYI, TortoiseGit Issue [#2710](https://gitlab.com/tortoisegit/tortoisegit/issues/2710) was filed and merge request [!50](https://gitlab.com/tortoisegit/tortoisegit/merge_requests/50) has already been submitted to fix this issue. – dthor Feb 25 '16 at 20:13