summaryrefslogtreecommitdiff
path: root/misc/hooks/pre-commit-black
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-08-30 11:17:04 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-08-30 11:18:11 +0200
commit4bf03afe8b70062cfca3336527294171e538ce25 (patch)
tree6374db37b8905649d04c6a018145f480464775ab /misc/hooks/pre-commit-black
parent432b25d3649319517827dbf7bc275e81e0a2b92e (diff)
Make Git hooks work on worktrees on Windows
Diffstat (limited to 'misc/hooks/pre-commit-black')
-rwxr-xr-xmisc/hooks/pre-commit-black4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black
index fd93bfe73c..b7335685ae 100755
--- a/misc/hooks/pre-commit-black
+++ b/misc/hooks/pre-commit-black
@@ -70,7 +70,7 @@ if [ ! -x "$BLACK" ] ; then
$XMSG -center -title "Error" "Error: black executable not found."
exit 1
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
- winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
+ winmessage="$(canonicalize_filename "$(dirname -- "$0")/winmessage.ps1")"
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -center -title "Error" --text "Error: black executable not found."
exit 1
fi
@@ -160,7 +160,7 @@ while true; do
yn="N"
fi
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
- winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
+ winmessage="$(canonicalize_filename "$(dirname -- "$0")/winmessage.ps1")"
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
choice=$?
if [ "$choice" = "100" ] ; then