-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Improve pre commit hook #17595
Improve pre commit hook #17595
Conversation
The documentation state that the function should return, but actually it exists. This is repaired. Removing `set -e` ensure the script does not stop if the linter fails. This is probably what we expected given that we put the return value in a variable. This would ensure that the patch that was saved is always restored. I don't expect this to cause issues because the remaining of the changes are not destructive. I manually tested that the bug can't be reproduced with this script. However, I've not tested the change in case of `git apply` failure, as I don't know how to force apply to fail. Fixed: ankidroid#17593
The variable meaning was not clear. It seemed to indicate it was actually the diff.
This ensures that, in case we have an issue and restore does not work, a future `git commit` don't overwrite the patch file.
e305041
to
0b09a82
Compare
How does this code differ from the currently generated hook? Can a subset of this be submitted upstream? |
The base of the bug is that we had Patch 2 by itself there is no reason to just ask them to rename a variable. Patch 3 may be nice. But honestly, I added just for extra safety. When their code work as expected (i.e. we have not added |
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.
Forgot to approve. LGTM!
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, my condolences for the last work that triggered this - hadn't commented on that but have seen the comments going around. What a pain
I expect first commit to be sufficient. Commit three is probably overkill. But I don't want to lose hours of work anymore. And the slight risk that, if we stop overwritting the same file all the time, we save data seems quite nicer than risking a repeat.
Fixed: #17591