mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #3487 from MikeMcQuaid/dev-env-filtering
Enable environment filtering for developers.
This commit is contained in:
commit
f262cbc531
@ -246,16 +246,6 @@ case "$HOMEBREW_COMMAND" in
|
|||||||
--config) HOMEBREW_COMMAND="config" ;;
|
--config) HOMEBREW_COMMAND="config" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -z "$HOMEBREW_DEVELOPER" ]]
|
|
||||||
then
|
|
||||||
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
|
|
||||||
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
|
|
||||||
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
|
|
||||||
then
|
|
||||||
export HOMEBREW_DEV_CMD_RUN="1"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
|
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
|
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
|
||||||
|
@ -185,6 +185,7 @@ class SystemConfig
|
|||||||
HOMEBREW_BREW_FILE
|
HOMEBREW_BREW_FILE
|
||||||
HOMEBREW_COMMAND_DEPTH
|
HOMEBREW_COMMAND_DEPTH
|
||||||
HOMEBREW_CURL
|
HOMEBREW_CURL
|
||||||
|
HOMEBREW_GIT_CONFIG_FILE
|
||||||
HOMEBREW_LIBRARY
|
HOMEBREW_LIBRARY
|
||||||
HOMEBREW_MACOS_VERSION
|
HOMEBREW_MACOS_VERSION
|
||||||
HOMEBREW_RUBY_PATH
|
HOMEBREW_RUBY_PATH
|
||||||
|
23
bin/brew
23
bin/brew
@ -59,6 +59,29 @@ do
|
|||||||
export "$VAR_NEW"="${!VAR}"
|
export "$VAR_NEW"="${!VAR}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Set HOMEBREW_DEVELOPER for users who have run a development command
|
||||||
|
if [[ -z "$HOMEBREW_DEVELOPER" ]]
|
||||||
|
then
|
||||||
|
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
|
||||||
|
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
|
||||||
|
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
|
||||||
|
then
|
||||||
|
export HOMEBREW_DEV_CMD_RUN="1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" ]]
|
||||||
|
then
|
||||||
|
if [[ -n "$HOMEBREW_DEVELOPER" || -n "$HOMEBREW_DEV_CMD_RUN" ]]
|
||||||
|
then
|
||||||
|
# Use env filtering by default for users who have run a development command
|
||||||
|
# This will be enabled by default for all users in future.
|
||||||
|
export HOMEBREW_ENV_FILTERING="1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
unset HOMEBREW_ENV_FILTERING
|
||||||
|
fi
|
||||||
|
|
||||||
# test-bot sets environment filtering itself
|
# test-bot sets environment filtering itself
|
||||||
if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]
|
if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user