<commit_before>require "cmd/tap"
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"

module Homebrew
  def update
    unless ARGV.named.empty?
      abort <<-EOS.undent
        This command updates brew itself, and does not take formula names.
        Use `brew upgrade <formula>`.
      EOS
    end

    # ensure git is installed
    Utils.ensure_git_installed!

    # ensure GIT_CONFIG is unset as we need to operate on .git/config
    ENV.delete("GIT_CONFIG")

    cd HOMEBREW_REPOSITORY
    git_init_if_necessary

    # migrate to new directories based tap structure
    migrate_taps
<commit_msg>update: add permissions check<commit_after>require "cmd/tap"
require "cmd/doctor"
require "formula_versions"
require "migrator"
require "formulary"
require "descriptions"

module Homebrew
  def update
    unless ARGV.named.empty?
      abort <<-EOS.undent
        This command updates brew itself, and does not take formula names.
        Use `brew upgrade <formula>`.
      EOS
    end

    # check permissions
    checks = Checks.new
    %w[
      check_access_usr_local
      check_access_homebrew_repository
    ].each do |check|
      out = checks.send(check)
      odie out unless out.nil?
    end

    # ensure git is installed
    Utils.ensure_git_installed!

    # ensure GIT_CONFIG is unset as we need to operate on .git/config
    ENV.delete("GIT_CONFIG")

    cd HOMEBREW_REPOSITORY
    git_init_if_necessary

    # migrate to new directories based tap structure
    migrate_taps

{'fraction_non_alphanumeric': 0.06470588235294118, 'fraction_numerical': 0.0, 'mean_word_length': 3.028947368421053, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1439184', 'n_tokens_mistral': 486, 'n_tokens_neox': 461, 'n_words': 148}