protected function getFileInfo($path)
 {
     $fileInfo = null;
     if ($this->validPathStr($path) === false) {
         throw new \Exception('Directory path is not valid. Possible security issue.');
     }
     $basePath = $this->addEndingSlash($this->command->getGitEnvironment()->getPath());
     if ($this->command->getGitEnvironment()->getSsh() === true) {
         //Remote Directory Listing
         $fileData = $this->command->getSftpProcess()->getFileStats($basePath . $path);
         $fileData['filename'] = basename($path);
         $fileData['fullPath'] = $basePath . $path;
         $fileData['gitPath'] = $path;
         $fileInfo = new RemoteFileInfo($fileData);
     } else {
         $splFileInfo = new \SPLFileInfo($basePath . $path);
         $splFileInfo->setInfoClass('\\VersionControl\\GitCommandBundle\\Entity\\FileInfo');
         $newFileInfo = $splFileInfo->getFileInfo();
         $newFileInfo->setGitPath($basePath . $path);
         $fileInfo = $newFileInfo;
     }
     return $fileInfo;
 }