src/Console/Helper/PathsHelper.php
public function getGitHooksDir(): string
    {
        $gitPath = $this->getGitDir();
        $absoluteGitPath = $this->getAbsolutePath($gitPath);
        $gitRepoPath = $absoluteGitPath.'/.git';

        if (is_file($gitRepoPath)) {
            $fileContent = $this->fileSystem->readFromFileInfo(new SplFileInfo($gitRepoPath));
            if (preg_match('/gitdir:\s+(\S+)/', $fileContent, $matches)) {
                $relativePath = $this->getRelativePath($matches[1]);
                return $this->getRelativePath($gitPath.$relativePath.'/hooks/');
            }
        }

        return $gitPath.'.git/hooks/';
    }
public function getGitHooksDir(): string
    {
        $gitPath = $this->getGitDir();
        $absoluteGitPath = $this->getAbsolutePath($gitPath);
        $gitRepoPath = $absoluteGitPath.'/.git';

        if (is_file($gitRepoPath)) {
            $fileContent = $this->fileSystem->readFromFileInfo(new SplFileInfo($gitRepoPath));
            if (preg_match('/gitdir:\s+(\S+)/', $fileContent, $matches)) {
                $relativePath = $this->getRelativePath($matches[1]);
                return $this->getRelativePath($gitPath.$relativePath.'/hooks/');
            }
        }

        return $gitPath.'.git/hooks/';
    }
public function getGitHooksDir ( ) : string { $ gitPath = $ this -> getGitDir ( ) ; $ absoluteGitPath = $ this -> getAbsolutePath ( $ gitPath ) ; $ gitRepoPath = $ absoluteGitPath . '/.git' ; if ( is_file ( $ gitRepoPath ) ) { $ fileContent = $ this -> fileSystem -> readFromFileInfo ( new SplFileInfo ( $ gitRepoPath ) ) ; if ( preg_match ( '/gitdir:\s+(\S+)/' , $ fileContent , $ matches ) ) { $ relativePath = $ this -> getRelativePath ( $ matches [ 1 ] ) ; return $ this -> getRelativePath ( $ gitPath . $ relativePath . '/hooks/' ) ; } } return $ gitPath . '.git/hooks/' ; }
Returns the directory where the git hooks are installed.
Returns the directory where the git hooks are installed .