You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i run the git-hook pre-commit on windows it will not do the formatting for my code, i think the problem is from internalKtlintGitFilter. Because when i delete it, it will perform well.
Notes : I just have 1 change file with broken rules to test the git-hook. And i didnt get this issue on macOS
The text was updated successfully, but these errors were encountered:
Having the same case. I have MINGW64 running the git commands and what I noticed is that pre-commit gives path with forward slashes '/', but then the code in the plugin GitHook checks for project root dir, which has backslashes('\') and filters out all the input values.
Possible workaround would be to replace '/' with '\' in hook:
FILTER_VALUE=
case "$(uname -sr)" in
CYGWIN*|MINGW*|MSYS*)
# replacing '/' with '\'
FILTER_VALUE="${CHANGED_FILES//\//\\}"
;;
*)
FILTER_VALUE=$CHANGED_FILES
;;
esac
echo "Running ktlint over these files:"
echo "$FILTER_VALUE"
./gradlew --quiet ktlintFormat -PinternalKtlintGitFilter="$FILTER_VALUE"
IlyaNerd
pushed a commit
to IlyaNerd/ktlint-gradle
that referenced
this issue
Jan 4, 2024
When i run the git-hook pre-commit on windows it will not do the formatting for my code, i think the problem is from
internalKtlintGitFilter
. Because when i delete it, it will perform well.Notes : I just have 1 change file with broken rules to test the git-hook. And i didnt get this issue on macOS
The text was updated successfully, but these errors were encountered: