-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload git patch when pre-commit fails #625
base: dev
Are you sure you want to change the base?
Upload git patch when pre-commit fails #625
Conversation
When pre-commit modify files but is not verbose about the changes, one case use git apply pre-commit.patch
This commit is just for demonstration, I will remove it soon. The patch is at: with contents:
|
@fauust after discussing with @RazvanLiviuVarzaru I suggest the following approach:
Let me know if this is clear enough. |
38a56d2
to
7014f98
Compare
Applied @cvicentiu idea on 7014f98 You can see in the log that isort let the files intact and wrote the diff's to the output: I prefer this over letting the hooks modify the files and then upload the patch. |
Yes, definitively, but please keep in mind that regular contributor should use pre-commit locally, see https://github.com/MariaDB/buildbot?tab=readme-ov-file#pre-commit. So, I am not sure what you mean by:
It should locally prevent a commit from being done, this way contributor would not have to wait for the CI to be failing to do a correct commit.
Yep appart from 1/ and also @RazvanLiviuVarzaru the trailing white space check is doing modification too, so we might want to put it in check mode only. |
@fauust , @cvicentiu Do you want to keep a hybrid approach? Meaning, let isort/black only check and for whitespace upload a patch. |
pre-commit/pre-commit-hooks#108 makes sense to me. I have the feeling that we are trying to implement something that nobody will use (well at least I personally don't need it since I have pre-commit installed locally).
Let's not waste time on the trailing spaces. If this PR helps you working with the project, I am ok with it. What you could do is to document this so that new contributors know how to use patches from GH actions. |
In typical development this is not desirable. There are many cases when one wants to do WIP commits, without having to worry about isort and black validity. |
In that case, that's of course possible locally https://pre-commit.com/#temporarily-disabling-hooks but pushing something knowing that the CI will be red is a bit strange IMO (appart from backup purpose of course!). |
When pre-commit modify files but is not verbose about the changes, one case use
git apply pre-commit.patch
(download the patch from GitHub Actions).