Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable environment filtering for developers. #3487

Merged
merged 1 commit into from Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions Library/Homebrew/brew.sh
Expand Up @@ -246,16 +246,6 @@ case "$HOMEBREW_COMMAND" in
--config) HOMEBREW_COMMAND="config" ;;
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" ]]
then
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/system_config.rb
Expand Up @@ -185,6 +185,7 @@ def dump_verbose_config(f = $stdout)
HOMEBREW_BREW_FILE
HOMEBREW_COMMAND_DEPTH
HOMEBREW_CURL
HOMEBREW_GIT_CONFIG_FILE
HOMEBREW_LIBRARY
HOMEBREW_MACOS_VERSION
HOMEBREW_RUBY_PATH
Expand Down
23 changes: 23 additions & 0 deletions bin/brew
Expand Up @@ -59,6 +59,29 @@ do
export "$VAR_NEW"="${!VAR}"
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
if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]
then
Expand Down