nextsimhub / nextsimdg

neXtSIM_DG : next generation sea-ice model with DG
https://nextsim-dg.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
10 stars 13 forks source link

Abort git commit if pre-commit applies formatting #737

Open jwallwork23 opened 3 days ago

jwallwork23 commented 3 days ago

In #660 we added a .pre-commit file that developers can use to automatically apply formatting and update datestamps. It's a minor annoyance that the commit still goes through even if changes were applied. Then you either have separate "Update datestamps" / "Formatting" commits or have to squash/fixup with git rebase.

This PR changes the pre-commit so that it aborts the commit if any changes were made. Then you just re-run the git commit command with the formatting/date changes included.