Skip to content

Commit 3a897ff

Browse files
authoredJan 26, 2022
fix: handle symlinked .git directories
1 parent 026aae0 commit 3a897ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎lib/resolveGitRepo.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const debugLog = debug('lint-staged:resolveGitRepo')
1414
* submodules and worktrees
1515
*/
1616
const resolveGitConfigDir = async (gitDir) => {
17-
const defaultDir = normalize(path.join(gitDir, '.git'))
17+
// Get the real path in case it's a symlink
18+
const defaultDir = normalize(await fs.realpath(path.join(gitDir, '.git')))
1819
const stats = await fs.lstat(defaultDir)
1920
// If .git is a directory, use it
2021
if (stats.isDirectory()) return defaultDir

0 commit comments

Comments
 (0)
Please sign in to comment.