A new version of `shellcheck` (I think?) brought us so new warnings and
errors.
To fix:
- pass `--source-path` so we don't need to stop `shellcheck` trying to
read sourced files every time
- disable some more warnings/errors we don't care about fixing
Specifically the warning:
`Failed to set filetime <unixtime> on outfile: Operation not permitted`
when the user's `.curlrc` contains `--remote-time` and the server
returned a `Last-Modified:` header, like in case of the GitHub API.
`HOMEBREW_CURL_PATH` has an effect only when `HOMEBREW_DEVELOPER` is set. However, the part of `brew.sh` that prints a message about outdated cURL disregards the value of `HOMEBREW_DEVELOPER`, which leads to a misleadnig message telling the user that `HOMEBREW_CURL_PATH` is outdated even though another cURL was used/tested.
This PR fixes it and instructs Homebrew to:
1. Display a warning message when system cURL is outdated and either `HOMEBREW_CURL_PATH` **or `HOMEBREW_DEVELOPER`** are not set. New `HOMEBREW_CURL_WARNING` variable is set to display the above warning only once (useful when `brew` calls itself internally).
2. Display `Installing Homebrew cURL` before auto-installing cURL in `update.sh` (due to `HOMEBREW_FORCE_BREWED_CURL`) and stop/exit if this step fails.
3. Display `Installing Homebrew Git` before auto-installing Git in `update.sh` (due to `HOMEBREW_FORCE_BREWED_GIT`) and stop/exit if this step fails.
GitHub has requested we request our usage of shallow clones. As a
result:
- do default to shallow clones on CI
- do not do --shallow-since when setting up new repositories in
`brew update`
- do not support shallow clones of homebrew-core at all
We may consider in future unshallowing all clones unconditionally.
This should help with cases like
https://github.com/Homebrew/homebrew-bundle/issues/751
and is good practise in general.
Also, document the `brew update --preinstall` flag that is being used
here so others can run it manually e.g. as part of CI if needed.
I tested the workaround with the newest Git and the Catalina system Git
and it wasn't needed in either case. We can re-add it if we get
complaints with supported Git versions.
Fixes https://github.com/Homebrew/brew/issues/7259