ExternalProject: Improve robustness of update step
This started out as just adding
--tags --force to the fetch during git update. As part of working on the test case for it, various shortcomings of the way the update step was implemented became apparent. A number of those shortcomings were discussed in the same associated issue, or at least symptoms of them. In the end, I opted to refactor the update step so that its logic is clearer and to fix a couple of issues that were previously going to go silently unnoticed by the user.
Fixes: #20677 (closed)