-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Resolve pre-commit hook causing conflicts #502
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rebase your PR against master
and put your changes into '[Unreleased]' changelog section?
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/GitHook.kt
Outdated
Show resolved
Hide resolved
@@ -157,8 +157,10 @@ class GitHookTasksTest : AbstractPluginTest() { | |||
build(":$INSTALL_GIT_HOOK_FORMAT_TASK").run { | |||
assertThat(task(":$INSTALL_GIT_HOOK_FORMAT_TASK")?.outcome).isEqualTo(TaskOutcome.SUCCESS) | |||
val hookText = gitDir.preCommitGitHook().readText() | |||
assertThat(hookText).contains("git stash push") | |||
assertThat(hookText).contains("git stash pop") | |||
assertThat(hookText).contains("git diff > unstaged.diff") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really need to come up with git hook test setup that actually runs installed githook on some test project 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only thing i don't like is if the patch fails to apply after format, |
4998ac1
to
84ed6cc
Compare
84ed6cc
to
34f18d0
Compare
resolves #497
The logic was using
git stash push --keep-index
which keeps the index but also adds it to the stash. I've change the functionality to use a .diff file with the changesgit diff > unstaged.diff
and reapply it withgit apply --ignore-whitespace unstaged.diff
, in my opinion using-3
would be better but then git applies it to the index, not the working copy.There isn't a current version in the changes so I bumped it to 10.1.1