git: do not validate submodules of fresh checkouts
Fixes #14603
What does this PR try to resolve?
As is, we unconditionally validate freshness of the submodules of a checkout, even though we could assume that a fresh checkout has to have up-to-date submodules as well.
How should we test and review this PR?
N/A
Additional information
N/A
r? @weihanglo
rustbot has assigned @weihanglo. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
We likely should update _corrupted_checkout test to have a submodule to show that we recovery gracefully on interruption,
Could you update the commits to be how you want them reviewed and merged?
For example, I could see this being
- Test commit
- Refactor for checkout guard
- Improve performance by adjusting the scope of the checkout guard
FYI ecb63986881a66020fbe599b8775485e58607b7b was what I was asking for in splitting out a refactor commit. It makes it easier to follow what is intended with the actual performance fix.