original_string: public function git_run($command)
      {
          $git = escapeshellarg(pake_which('git'));
  
          if (self::$needs_work_tree_workaround === true) {
              $cmd = '(cd '.escapeshellarg($this->repository_path).' && '.$git.' '.$command.')';
          } else {
              $cmd = $git;
              $cmd .= ' --git-dir='.escapeshellarg($this->repository_path.'/.git');
              $cmd .= ' --work-tree='.escapeshellarg($this->repository_path);
              $cmd .= ' '.$command;
          }
  
          try {
              return pake_sh($cmd);
          } catch (pakeException $e) {
              if (strpos($e->getMessage(), 'cannot be used without a working tree') !== false ||
                  // workaround for windows (using win7 and git 1.7.10)
                  strpos($e->getMessage(), 'fatal: Could not switch to ') !== false) {
                  pake_echo_error('Your version of git is buggy. Using workaround');
                  self::$needs_work_tree_workaround = true;
                  return $this->git_run($command);
              }
  
              throw $e;
          }
      }
code: public function git_run($command)
      {
          $git = escapeshellarg(pake_which('git'));
  
          if (self::$needs_work_tree_workaround === true) {
              $cmd = '(cd '.escapeshellarg($this->repository_path).' && '.$git.' '.$command.')';
          } else {
              $cmd = $git;
              $cmd .= ' --git-dir='.escapeshellarg($this->repository_path.'/.git');
              $cmd .= ' --work-tree='.escapeshellarg($this->repository_path);
              $cmd .= ' '.$command;
          }
  
          try {
              return pake_sh($cmd);
          } catch (pakeException $e) {
              if (strpos($e->getMessage(), 'cannot be used without a working tree') !== false ||
                  // workaround for windows (using win7 and git 1.7.10)
                  strpos($e->getMessage(), 'fatal: Could not switch to ') !== false) {
                  pake_echo_error('Your version of git is buggy. Using workaround');
                  self::$needs_work_tree_workaround = true;
                  return $this->git_run($command);
              }
  
              throw $e;
          }
      }
code_tokens: public function git_run ( $ command ) { $ git = escapeshellarg ( pake_which ( 'git' ) ) ; if ( self :: $ needs_work_tree_workaround === true ) { $ cmd = '(cd ' . escapeshellarg ( $ this -> repository_path ) . ' && ' . $ git . ' ' . $ command . ')' ; } else { $ cmd = $ git ; $ cmd .= ' --git-dir=' . escapeshellarg ( $ this -> repository_path . '/.git' ) ; $ cmd .= ' --work-tree=' . escapeshellarg ( $ this -> repository_path ) ; $ cmd .= ' ' . $ command ; } try { return pake_sh ( $ cmd ) ; } catch ( pakeException $ e ) { if ( strpos ( $ e -> getMessage ( ) , 'cannot be used without a working tree' ) !== false || // workaround for windows (using win7 and git 1.7.10) strpos ( $ e -> getMessage ( ) , 'fatal: Could not switch to ' ) !== false ) { pake_echo_error ( 'Your version of git is buggy. Using workaround' ) ; self :: $ needs_work_tree_workaround = true ; return $ this -> git_run ( $ command ) ; } throw $ e ; } }
docstring: Run git-command in context of repository
  
  This method is useful for implementing some custom command, not implemented by pake.
  In cases when pake has native support for command, please use it, as it will provide better compatibility
  
  @param $command
docstring_tokens: Run git - command in context of repository