Class: Git::Commands::Worktree::Lock Private

Inherits:
ManagementBase show all
Defined in:
lib/git/commands/worktree/lock.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-worktree/2.54.0

Locks a worktree to prevent it from being pruned

Examples:

Lock a worktree

Git::Commands::Worktree::Lock.new(execution_context).call('/tmp/feature')

Lock with a reason message

Git::Commands::Worktree::Lock.new(execution_context).call('/tmp/feature', reason: 'on NFS share')

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(worktree, **options) ⇒ Git::CommandLineResult

Lock a worktree to prevent it from being pruned

Parameters:

  • worktree (String)

    path or unique suffix identifying the worktree to lock

  • options (Hash)

    command options

Options Hash (**options):

  • :reason (String) — default: nil

    human-readable explanation stored alongside the lock

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/worktree/lock.rb', line 34