Other: Run pre-commit only on staged changes#2182
Conversation
Should prevent the following scenario: pre-commit fails and the dev does some changes Changes are not commited pre-commit runs again, but successfull Non-updated commit gets push, CI fails With this update the pre-commit will fail again, because the un-commited changes are stashed
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2182 +/- ##
=======================================
Coverage 77.97% 77.97%
=======================================
Files 113 113
Lines 19106 19106
=======================================
Hits 14898 14898
Misses 4208 4208 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I don't know when exactly the pre-commit is performed. If it is really before the commit, this will also stash the added changes which this script should control |
|
About the question: If they are not added then yes :) |
Nvm, I did not know about the --keep-index option |
The pre-commit is performed when you execute "git commit", befor the commit is created. It sits between "git add" and "git commit". |
Closes #1466
Updates the pre-commit script to do the following:
############### QUESTION #################
Should we also include untracked files to the stash?
All these boxes must be checked by the AUTHOR before requesting review:
Documentation:,Bugfix:,Feature:,Improvement:orOther:.All these boxes must be checked by the REVIEWERS before merging the pull request:
As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.
General
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scpto check the indentation of these files.License
doc/(or already has one).