diff --git a/CHANGELOG.md b/CHANGELOG.md index e0506f31..a00a1647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - fix new ktlint errors that come from our new default version of ktlint [#651](https://github.com/JLLeitschuh/ktlint-gradle/pull/651) - fix syntax bug in release logic for VERSION_LATEST_RELEASE.txt [#651](https://github.com/JLLeitschuh/ktlint-gradle/pull/651) +- fix the pre-commit hook to cope with unstaged binary files [#603](https://github.com/JLLeitschuh/ktlint-gradle/pull/603) ### Changed diff --git a/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt b/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt index 607874ae..00f3878a 100644 --- a/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt +++ b/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt @@ -80,7 +80,7 @@ internal fun generateGitHook( echo "${'$'}CHANGED_FILES" diff=.git/unstaged-ktlint-git-hook.diff - git diff --color=never > ${'$'}diff + git diff --binary --color=never > ${'$'}diff if [ -s ${'$'}diff ]; then git apply -R ${'$'}diff fi