Be a lot more conservative in _github_submodule_required #708
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This function is used to decide whether we can use github directly to download the code without cloning the repository. That optimization only works if the repository doesn't have submodules.
Before this commit, if github returned any status code that wasn't a 2xx or 3xx, we would consider that the repository didn't have any submodule. This is fairly obviously wrong as a transient server error on the github side for example would mean that we'd assume that the repository doesn't have any submodules.
We now check for HTTPErrors and only consider that a repository doesn't have any submodule iif the status is 404 otherwise, something went wrong, log it and fallback to the non optimized path.
I also kept the bare exception but added some log to it, just in case.