bugfix commit order: fix or test first?
@adam-mercer @duncanmmacleod Talking to @karl-wette over on !1294 (merged) (not really necessary to read that one for context, unless my following summary is too unclear), I wasn't sure what the recommended order for commits on a bugfix MR is for this project:
- first commit a test that exposes the bug, then the fix
- first fix the bug, then the test to at least make sure it doesn't come up again
- put test and fix into the same commit
Option 1 is what I've often heard recommended as good development practice, but on the other hand having commits with failing tests in the history can make some things more difficult, e.g. bisecting.
So if you have a clear opinion, I'd be happy to follow it, whichever it is. If so, I can also volunteer to add this to the contributing guide. But if the reply is "it depends on the bug / the package / ..." that's also ok.