Search code examples
hookgit-committortoisegit

TortoiseGit's start-commit hook is executed too late


I'm using TortoiseGit 2.8.0.0 with Git 2.20.1.windows.1 on Windows 10. In TGit I specified a start_commit_hook to execute a .bat file from the home folder of the local repository.

According to TortoiseGit Manual:

Start-commit: Called before the commit dialog is shown. You might want to use this if the hook modifies a versioned file and affects the list of files that need to be committed and/or commit message. However you should note that because the hook is called at an early stage, the full list of objects selected for commit is not available.

And indeed that's what I want: The hook shall modify some files before they are committed, while this is not regarding the commit message.

Problem: The hook script is executed later than expected. This happens after the commit has been executed, which causes the files to be changed after the commit is finished.

Did I miss anything to configure?


Solution

  • There was a bug in the stable version. Please use the latest preview for now until the next stable version >= 2.9 is released.

    UPDATE: The stable version >= 2.9 is released, see https://tortoisegit.org/download/