protected function guessGitDir()
{
$defaultGitDir = $this->config->getGitDir();
try {
$topLevel = $this->repository->run('rev-parse', ['--show-toplevel']);
} catch (Exception $e) {
return $defaultGitDir;
}
return rtrim($this->paths()->getRelativePath($topLevel), '/');
}