module Git::CommandLine

Namespace module for git command-line execution strategies

This module groups the classes responsible for invoking git subprocesses and handling their output. Choose a concrete class based on your buffering needs:

Both classes inherit from {Git::CommandLine::Base} and are used internally by {Git::ExecutionContext#command_capturing} and {Git::ExecutionContext#command_streaming}.

Results are returned as {Git::CommandLine::Result} objects (also accessible as {Git::CommandLine::Result} for backward compatibility).

@example Buffered command via Git::CommandLine::Capturing

cli = Git::CommandLine::Capturing.new(
  {}, '/usr/bin/git', [], Logger.new(nil)
)
result = cli.run('version')
result.stdout #=> "git version 2.39.1\n"

@example Streaming command via Git::CommandLine::Streaming

cli = Git::CommandLine::Streaming.new(
  {}, '/usr/bin/git', [], Logger.new(nil)
)
File.open('/tmp/blob', 'wb') do |f|
  cli.run('cat-file', 'blob', sha, out: f)
end

@see Git::CommandLine::Base

@see Git::CommandLine::Result

@api private