Skip to content

Commit

Permalink
Enable HOMEBREW_AUTOREMOVE by autoremove_default
Browse files Browse the repository at this point in the history
Enabled `HOMEBREW_AUTOREMOVE` by default, and added
`HOMEBREW_NO_AUTOREMOVE` to disable it.
  • Loading branch information
MikeMcQuaid committed May 9, 2024
1 parent fbb73ba commit ca97c0d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def clean!(quiet: false, periodic: false)
cleanup_formula(formula, quiet:, ds_store: false, cache_db: false)
end

Cleanup.autoremove(dry_run: dry_run?) if Homebrew::EnvConfig.autoremove?
Cleanup.autoremove(dry_run: dry_run?) unless Homebrew::EnvConfig.no_autoremove?

cleanup_cache
cleanup_empty_api_source_directories
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def run
)
end

Cleanup.autoremove if Homebrew::EnvConfig.autoremove?
Cleanup.autoremove unless Homebrew::EnvConfig.no_autoremove?
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ module EnvConfig
"configuration. Please ensure you always run `brew update` before reporting any issues.",
boolean: true,
},
HOMEBREW_NO_AUTOREMOVE: {
description: "If set, calls to `brew cleanup` and `brew uninstall` not automatically " \
"remove unused formula dependents.",
boolean: true,
},
HOMEBREW_NO_BOOTSNAP: {
description: "If set, do not use Bootsnap to speed up repeated `brew` calls.",
boolean: true,
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca97c0d

Please sign in to comment.