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
It would be great if the git hooks provided by ktlint via installGitPreCommitHook/installGitPrePushHook were made for executing on git diff only.
Expected Behavior
ktlint git pre-commit and pre-push hooks run on changed files only.
Current Behavior
ktlint git pre-commit and pre-push hooks run on all files of the current directory.
For instance, when I install the pre-commit hook via ktlint installGitPreCommitHook, it looks like this:
As you can see, the first command lists changed files, then only kt[s] files are selected, and finally they are piped into the ktlint command. Unfortunately, last argument of the ktlint command is the current directory, meaning that in addition to changed files, also the entire current directory is going to be checked. Basically, the current directory "overrides" the piped git diff files.
Additional information
Current version of ktlint: 0.43.2
Looks like ktlint's git hooks have never changed, but I observed a performance decrease from version 0.40 to 0.41 and higher (see 0.41.0 Performance decrease #1135 (comment)). This performance decrease brought me here.
The text was updated successfully, but these errors were encountered:
It would be great if the git hooks provided by ktlint via
installGitPreCommitHook/installGitPrePushHook
were made for executing on git diff only.Expected Behavior
ktlint git pre-commit and pre-push hooks run on changed files only.
Current Behavior
ktlint git pre-commit and pre-push hooks run on all files of the current directory.
For instance, when I install the pre-commit hook via
ktlint installGitPreCommitHook
, it looks like this:As you can see, the first command lists changed files, then only
kt[s]
files are selected, and finally they are piped into thektlint
command. Unfortunately, last argument of thektlint
command is the current directory, meaning that in addition to changed files, also the entire current directory is going to be checked. Basically, the current directory "overrides" the piped git diff files.Additional information
The text was updated successfully, but these errors were encountered: