Method: Git::CommandLine#initialize

Defined in:
lib/git/command_line.rb

#initialize(env, binary_path, global_opts, logger) ⇒ CommandLine

Create a Git::CommandLine object

Examples:

env = { 'GIT_DIR' => '/path/to/git/dir' }
binary_path = '/usr/bin/git'
global_opts = %w[--git-dir /path/to/git/dir]
logger = Logger.new(STDOUT)
cli = CommandLine.new(env, binary_path, global_opts, logger)
cli.run('version') #=> #<Git::CommandLineResult:0x00007f9b0c0b0e00

Parameters:

  • env (Hash<String, String>)

    environment variables to set

  • global_opts (Array<String>)

    global options to pass to git

  • logger (Logger)

    the logger to use



28
29
30
31
32
33
# File 'lib/git/command_line.rb', line 28

def initialize(env, binary_path, global_opts, logger)
  @env = env
  @binary_path = binary_path
  @global_opts = global_opts
  @logger = logger
end