def command(cmd, opts = [], chdir = true, redirect = '', &block)
      ENV['GIT_INDEX_FILE'] = File.join(workdir, '.git', 'index')
      ENV['GIT_DIR'] = File.join(workdir, '.git')
      ENV['GIT_WORK_TREE'] = workdir
      path = workdir

      git_cmd = create_git_command(cmd, opts, redirect)

      out = command_git_cmd(path, git_cmd, chdir, block)

      if logger
        logger.debug(git_cmd)
        logger.debug(out)
      end

      handle_exitstatus($?, git_cmd, out)
    end
def command(cmd, opts = [], chdir = true, redirect = '', &block)
      ENV['GIT_INDEX_FILE'] = File.join(workdir, '.git', 'index')
      ENV['GIT_DIR'] = File.join(workdir, '.git')
      ENV['GIT_WORK_TREE'] = workdir
      path = workdir

      git_cmd = create_git_command(cmd, opts, redirect)

      out = command_git_cmd(path, git_cmd, chdir, block)

      if logger
        logger.debug(git_cmd)
        logger.debug(out)
      end

      handle_exitstatus($?, git_cmd, out)
    end
Executes the given git command

 @param [Symbol, String] cmd the command to run (e.g., :commit)
 @param [Array<String, Symbol>] opts the arguments to pass to the command
 @param [Boolean] chdir should the shell change to the top of the working dir before executing the command?
 @param [String] redirect ???????
 @yield the block to run in the context of running the command

 @return [String] the output of the git command