Carlo Cabrera 6f63be411b
bin/brew: refine generation of HOMEBREW_* env vars
We inherit some variables from the user's environment but prefix them
with `HOMEBREW_`. This is the case for (1) variables documented in the
manpage and also for some (2) variables used internally by `brew`.

We currently treat both types identically, but we should not. In
particular, we allow users to override type (1), but we don't want to do
this for type (2).

This was partially fixed in f4103e5d61526cfbf7f31540ba45ec171adc452e,
but that fix did not go far enough. Some variables that the user should
not be allowed to override can still be overridden.

This change completes the partial fix and refactors the code so that
we're less likely to mistakenly conflate the two types of variables in
the future.
2023-02-15 13:27:02 +08:00
..