-
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
git hook: don't commit whole file #470
Conversation
Could you add some test verifying this behaviour and update changelog? |
@Tapchicoma Can you re-review this please. Also, how do you build this project at all? I can only get pages of gradle errors and the steps in the readme didn't help. |
If you want to run some test - best option is to open Also sample project automatically apply all current changes from plugin subproject. |
@@ -138,6 +138,30 @@ class GitHookTasksTest : AbstractPluginTest() { | |||
} | |||
} | |||
|
|||
@Test | |||
internal fun `Format hook should not add non-indexed code to the commit`() { | |||
// TODO: This test doesn't run git or verify that only indexed code is committed, |
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.
Too bad JGit does have partial staging 😒
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.
What do you mean?
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.
LGTM!
Thank you for addressing this issue 👍
This updated precommit hook causes conflicts when you try to commit a badly-formatted change. See #497. |
When you commit part of a file the current git hook will change your commit to being the entire file.
This pr stashes the worktree before fmt, and unstashed before finished