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
I frequently make commits that contain just hunks of a file using git add --patch (usually when I have several changes locally that I want to split into separate commits). When the pre-commit runs on files where I've done that, it blindly stages the rest of the file, changing what I was committing.
My guess is that this is needed for the ktlintFormat pre-commit hook to add any changes made into the commit. However, I believe this is not needed for the ktlintCheck pre-commit hook (which is what I'm using), since it does not change any files.
I've fixed this for myself by simply removing that loop from the hook.
The text was updated successfully, but these errors were encountered:
This line of the pre-commit hook causes problems for me: https://github.com/JLLeitschuh/ktlint-gradle/blob/master/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt#L46
I frequently make commits that contain just hunks of a file using
git add --patch
(usually when I have several changes locally that I want to split into separate commits). When the pre-commit runs on files where I've done that, it blindly stages the rest of the file, changing what I was committing.My guess is that this is needed for the
ktlintFormat
pre-commit hook to add any changes made into the commit. However, I believe this is not needed for thektlintCheck
pre-commit hook (which is what I'm using), since it does not change any files.I've fixed this for myself by simply removing that loop from the hook.
The text was updated successfully, but these errors were encountered: