Class: Git::Commands::ConfigOptionSyntax::UnsetAll Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/config_option_syntax/unset_all.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

arguments block audited against https://git-scm.com/docs/git-config/2.53.0

Remove all matching config entries

Wraps git config --unset-all to remove all entries matching the given key name and optional value regex.

Examples:

Unset all values for a key

cmd = Git::Commands::ConfigOptionSyntax::UnsetAll.new(lib)
cmd.call('remote.origin.fetch')

Unset all values matching a pattern

cmd = Git::Commands::ConfigOptionSyntax::UnsetAll.new(lib)
cmd.call('core.gitproxy', 'for kernel.org$')

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(name, value_regex = nil, **options) ⇒ Git::CommandLineResult

Execute the git config --unset-all command

Parameters:

  • name (String)

    the config key name to unset

  • value_regex (String, nil) (defaults to: nil)

    (nil) optional regex to match values to remove

  • options (Hash)

    command options

Options Hash (**options):

  • :global (Boolean, nil) — default: nil

    remove from global config (~/.gitconfig)

  • :system (Boolean, nil) — default: nil

    remove from system config

  • :local (Boolean, nil) — default: nil

    remove from repository config (.git/config)

  • :worktree (Boolean, nil) — default: nil

    remove from worktree config

  • :file (String) — default: nil

    remove from the specified file

    Alias: :f

  • :blob (String) — default: nil

    read from the specified blob

  • :fixed_value (Boolean, nil) — default: nil

    treat the value regex as an exact string

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits outside the allowed range (exit code > 5)



# File 'lib/git/commands/config_option_syntax/unset_all.rb', line 53