class Git::Commands::Worktree::ManagementBase
Shared base class for worktree management subcommands
Overrides the βenv` method from {Git::Commands::Base} to unconditionally unset `GIT_INDEX_FILE` in the subprocess environment. Git worktrees maintain their own index files; passing a `GIT_INDEX_FILE` override when running management commands causes silent corruption of both the main worktree and linked worktree indexes.
All worktree management subcommands ({Add}, {Lock}, {Move}, {Prune}, {Remove}, {Repair}, {Unlock}) inherit from this class. The read-only {List} subcommand uses {Git::Commands::Base} directly.
@example Defining a new worktree management subcommand
class Archive < Git::Commands::Worktree::ManagementBase arguments do literal 'worktree' literal 'archive' operand :path, required: true end end
@see Git::Commands::Base
@api private
Private Instance Methods
Source
# File lib/git/commands/worktree/management_base.rb, line 45 def env { 'GIT_INDEX_FILE' => nil } end
Returns environment variable overrides that unset βGIT_INDEX_FILE`
@return [Hash] the environment variable overrides, always
`{ 'GIT_INDEX_FILE' => nil }`
@api private