stop test runner if working tree becomes dirty#20
stop test runner if working tree becomes dirty#20hoffbrinkle wants to merge 1 commit intomhagger:masterfrom
Conversation
A command may leave the working tree dirty (e.g. the command is applying code formatters to the tree). In such a case, we should stop running tests and allow the user to deal with it at the change that caused the code to change.
|
This is a great idea! 👈 corrected Wouldn't we want some kind of custom error message explaining that the reason for the failure was that the test modified the working tree, as opposed to the test returning an error result? It seems like it could be confusing otherwise. Or does git's output already make it quite clear why the commit was considered a failure? What would happen in this case if the Also, I'm not sure that the commit should necessarily be considered to have "failed" in this case. Sure, if one of the "tests" is to run a code formatter over the code, then it seems like a modified source tree should be considered a failure. OTOH if you want a test like that, the test itself should ideally include its own check that the source tree was not modified. But there are other situations where the source tree can appear "dirty". For example, suppose that a build target is removed, and at the same time a corresponding Summary: I love the idea of having a clear error for the "dirty tree" situation. I think this PR is already an improvement on the status quo, though I'm wondering whether it could give the user better information/guidance to help them figure out how to proceed. |
|
Thanks for the feedback! Obviously, this was a quick change that solved my immediate need. However, I agree that it could certainly be made more robust and feature complete.
While I could incorporate the workspace checking in to the command, the same could be said for many features. Seems like anything that is integrating with git is probably best done by this infrastructure. I think it'd be a common enough use case that there'd be value add in handling this with this I'm going to be busy for at least the next week, possibly three weeks, but I think we may as well come up with at least come up with a strategy for many of the cases you outline above, and then I can go back and improve this PR. I may just create an separate issue for it and do it there. However, it's going to be a week or three before I can devote some thought to it. |
A command may leave the working tree dirty (e.g. the command is applying
code formatters to the tree). In such a case, we should stop running
tests and allow the user to deal with it at the change that caused the
code to change.