Implement submodule warnings
This branch introduces new configurable warnings for the git source.
git:unlisted-submodule
This is emitted in the case that:
- A submodule exists in the underlying git repository
- The submodule is not disabled for checkout
- The source configuration does not specify the submodule
This helps ensure that people alias the submodules they are using so that they are useful in mirroring and relocation of project sources, and also helps to generally increase awareness of the submodules which are in use.
git:invalid-submodule
This is emitted in the case that:
- A submodule is specified in the source configuration
- The submodule does not exist in the underlying git repository
Implementation details
This adds a new Source.validate_cache()
method for the purpose of validating
what is found in a cached set of sources.
This can be used for validating certain expectations after the sources are
downloaded, for instance it can be used to ensure that a tarball contains
a subdirectory which the tar
source specifies should be extracted.
Side effects
This branch has the beneficial side effect of not downloading the submodules in
the case that the submodules are not used. Previously the checkout-submodules
and per submodule configurations specifying whether the submodules were needed
was only used to omit the submodules at staging time, but the submodules were
still needlessly downloaded at fetch time.
Further, the ref-not-in-track
CoreWarning
is reimplemented to be checked
at Source.validate_cache()
time, which has the benefit of finding that warning
earlier in the session when possible, while also untangling the git
source
plugin a bit more and making it more readable and comprehensive.