I have a commit hook in my repo which adds the current branch name to the start of every commit comment.
This is the code:
# Inserts current branch name before commit message.
BRANCH=$(git symbolic-ref HEAD | sed 's#refs/heads/##')
sed -i '1s;^;'[$BRANCH]' ;' $COMMIT_MSG_FILE
/usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
It is in the file .git\hooks\prepare-commit-msg
This hook works when I commit in Bash console or when I use SublimeMerge or other git clients.
However, in Visual Studio 2019 without this extension, commits were failing with the error below (or see screenshot):
.git/hooks/prepare-commit-msg: line 4:
/usr/bin/perl: No such file or directory
This seems to be because VS 2019 is using its own Git install, which doesn't include perl.
Then I found this extension, which allows me to specify my default Git installation in the settings. When I use EZ-GIT to perform a commit (screenshot), it "works" (doesn't complain) but the hook script is still not run.
The EZ-GIT settings for Git seem correct (path is C:\Program Files\Git\bin\git.exe).
Expected behaviour is that performing a commit will trigger the commit hook script, same as it does in Bash, SublimeMerge etc.
I have a commit hook in my repo which adds the current branch name to the start of every commit comment.
This is the code:
It is in the file
.git\hooks\prepare-commit-msgThis hook works when I commit in Bash console or when I use SublimeMerge or other git clients.
However, in Visual Studio 2019 without this extension, commits were failing with the error below (or see screenshot):
This seems to be because VS 2019 is using its own Git install, which doesn't include perl.
Then I found this extension, which allows me to specify my default Git installation in the settings. When I use EZ-GIT to perform a commit (screenshot), it "works" (doesn't complain) but the hook script is still not run.
The EZ-GIT settings for Git seem correct (path is C:\Program Files\Git\bin\git.exe).
Expected behaviour is that performing a commit will trigger the commit hook script, same as it does in Bash, SublimeMerge etc.