/** * Adds File to .gitignore and remove file git index. * * @Route("/ignore/{filePath}", name="project_fileignore") * @Method("GET") * @Template("VersionControlGitControlBundle:ProjectFiles:fileList.html.twig") * @ProjectAccess(grantType="MASTER") */ public function ignoreAction($id, $filePath) { //$this->initAction($id,'MASTER'); $params = array('id' => $id); $filePath = trim(urldecode($filePath)); $pathInfo = pathinfo($filePath); if (trim($pathInfo['dirname']) && $pathInfo['dirname'] != '.') { $currentDir = $pathInfo['dirname']; $params['currentDir'] = $currentDir . '/'; } try { $response = $this->gitFilesCommands->ignoreFile($filePath, $this->branchName); $this->get('session')->getFlashBag()->add('notice', $response); } catch (\Exception $e) { $this->get('session')->getFlashBag()->add('error', $e->getMessage()); } return $this->redirect($this->generateUrl('project_filelist', $params)); }