Skip to content

Commit c4a39fc

Browse files
committed
Apply realpath only if valid directory was returned
1 parent f90b682 commit c4a39fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ function global_hook_dir()
4747
*/
4848
function git_dir()
4949
{
50-
$gitDir = realpath(trim(shell_exec('git rev-parse --git-common-dir')));
50+
$gitDir = trim(shell_exec('git rev-parse --git-common-dir'));
5151
if ($gitDir === null || $gitDir === '' || $gitDir === '--git-common-dir') {
5252
// the version of git does not support `--git-common-dir`
5353
// we fallback to `--git-dir` which and lose worktree support
5454
return realpath(trim(shell_exec('git rev-parse --git-dir')));
5555
}
5656

57-
return $gitDir;
57+
return realpath($gitDir);
5858
}
5959
}

0 commit comments

Comments
 (0)