Class: Git::Commands::UpdateRef::Delete Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/update_ref/delete.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-update-ref/2.53.0

Deletes a ref via git update-ref -d

Removes the named ref after optionally verifying it still contains <oldvalue>. Follows symbolic refs by default unless no_deref: true is given.

Examples:

Delete a branch ref

cmd = Git::Commands::UpdateRef::Delete.new(execution_context)
cmd.call('refs/heads/old-branch')

Delete with old-value verification

cmd = Git::Commands::UpdateRef::Delete.new(execution_context)
cmd.call('refs/heads/old-branch', 'expected-sha')

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(ref, oldvalue = nil, **options) ⇒ Git::CommandLineResult

Execute the git update-ref -d command

Parameters:

  • ref (String)

    the ref to delete (e.g. refs/heads/old-branch)

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

    (nil) expected current value of the ref

    When provided, the delete is rejected unless the ref currently points to this object.

  • options (Hash)

    command options

Options Hash (**options):

  • :m (String) — default: nil

    a reflog message for the deletion

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

    overwrite the ref itself rather than following symbolic refs

  • :timeout (Numeric) — default: nil

    abort the command after this many seconds

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (ArgumentError)

    if the ref operand is missing

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/update_ref/delete.rb', line 55