Skip to content

Commit

Permalink
Normalize usage of DIRECTORY_SEPARATOR constant
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-jaskulski committed Nov 26, 2024
1 parent 7acf19a commit 4bc1871
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Locator/GitRepositoryDirLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ public function locate(string $gitDir): string
$gitRepositoryDir = $matches[1];

if ($this->filesystem->isAbsolutePath($gitRepositoryDir)) {
if (!$this->filesystem->isFile($gitRepositoryDir . DIRECTORY_SEPARATOR . 'commondir')) {
if (!$this->filesystem->isFile($gitRepositoryDir.DIRECTORY_SEPARATOR.'commondir')) {
throw new RuntimeException('The git directory for worktree could not be found.');
}
$worktreeRelativeRoot = trim($this->filesystem->readPath($gitRepositoryDir . '/commondir'));

$worktreeRelativeRoot = trim(
$this->filesystem->readPath(
$gitRepositoryDir.DIRECTORY_SEPARATOR.'commondir'
)
);

return $this->filesystem->realpath(
$this->filesystem->makePathAbsolute(
$worktreeRelativeRoot,
Expand Down

0 comments on commit 4bc1871

Please sign in to comment.