class Git::ExecutionContext

Base class for execution contexts that run git commands

An execution context bundles three concerns that together describe how and where a git command runs:

  1. **Repository scope** — the public accessors ‘git_dir`, `git_work_dir`, `git_index_file`, and `git_ssh` identify which repository git targets and which SSH wrapper to use. Their values are translated into `GIT_*` environment variable overrides by the private `env_overrides` method. A `nil` value unsets the variable (see `Process.spawn` semantics).

  2. **CLI global options** — the private ‘global_opts` method returns the array of git flags prepended to every invocation: `–git-dir` / `–work-tree` when those attributes are set, plus the static options in {STATIC_GLOBAL_OPTS} that ensure deterministic, script-friendly output.

  3. **Execution defaults** — {COMMAND_CAPTURING_ARG_DEFAULTS} and {COMMAND_STREAMING_ARG_DEFAULTS} define the default values for I/O, encoding, and behavioral options (‘in:`, `out:`, `normalize:`, `timeout:`, etc.) accepted by {#command_capturing} and {#command_streaming}.

Subclasses override the repository-scope accessors to supply context-specific values. The ‘env_overrides` and `global_opts` methods are implemented here and call those accessors, so subclasses do not need to override them directly.

Concrete subclasses:

@example Using a concrete subclass

context = Git::ExecutionContext::Global.new(binary_path: '/usr/local/bin/git2')
context.binary_path  #=> "/usr/local/bin/git2"

@api private