Commit a97b72f5 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Recherche le dépôt .git dans les parents s'il n'est pas trouvé en local.

No related merge requests found
Showing with 11 additions and 1 deletion
+11 -1
......@@ -167,7 +167,8 @@ final class Config extends PhpCsFixerConfig
$fileLocator = new FileLocator($callerPath);
$composerPackage = new ComposerPackage($fileLocator);
$gitRepository = new GitRepository($callerPath);
$repoPath = self::findGitRepository($callerPath);
$gitRepository = new GitRepository($repoPath);
$headerProvider = new FormattedHeaderProvider(
new ChainTemplateProvider(
......@@ -182,4 +183,13 @@ final class Config extends PhpCsFixerConfig
return new self($composerPackage, $headerProvider);
}
private static function findGitRepository(string $path): string
{
while (!is_dir($path . '/.git') && $path !== '/') {
$path = basename($path);
}
return $path;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment