Class: Git::Commands::Worktree::Repair Private

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

Repairs worktree administrative files

Resolves broken links between the repository and one or more linked worktrees. Useful after a worktree directory is moved manually.

Examples:

Repair all registered worktrees

Git::Commands::Worktree::Repair.new(execution_context).call

Repair specific moved worktrees

Git::Commands::Worktree::Repair.new(execution_context).call('/tmp/moved1', '/tmp/moved2')

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

Repair worktree administrative files

Parameters:

  • path (Array<String>)

    paths to specific worktrees to repair

    When omitted, all registered worktrees are repaired.

  • options (Hash)

    command options

Options Hash (**options):

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

    link worktrees using relative paths (--relative-paths)

    Overrides the worktree.useRelativePaths config option.

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

    use absolute paths for worktree links (--no-relative-paths)

    Overrides the worktree.useRelativePaths config option. Also causes repair to update linking files if there is an absolute/relative mismatch, even if the links are already correct.

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status

  • (Git::VersionError)

    if git version is below 2.29.0



# File 'lib/git/commands/worktree/repair.rb', line 40