diff --git a/lib/resolveGitRepo.js b/lib/resolveGitRepo.js index 23b03832c..3e7460369 100644 --- a/lib/resolveGitRepo.js +++ b/lib/resolveGitRepo.js @@ -14,7 +14,8 @@ const debugLog = debug('lint-staged:resolveGitRepo') * submodules and worktrees */ const resolveGitConfigDir = async (gitDir) => { - const defaultDir = normalize(path.join(gitDir, '.git')) + // Get the real path in case it's a symlink + const defaultDir = normalize(await fs.realpath(path.join(gitDir, '.git'))) const stats = await fs.lstat(defaultDir) // If .git is a directory, use it if (stats.isDirectory()) return defaultDir