lint-staged
Advanced tools
Comparing version 11.2.0 to 11.2.1
@@ -28,6 +28,16 @@ 'use strict' | ||
const determineGitDir = (cwd, relativeDir) => { | ||
if (relativeDir) { | ||
// the current working dir is inside the git top-level directory | ||
return normalize(cwd.substring(0, cwd.lastIndexOf(relativeDir))) | ||
} else { | ||
// the current working dir is the top-level git directory | ||
return normalize(cwd) | ||
} | ||
} | ||
/** | ||
* Resolve git directory and possible submodule paths | ||
*/ | ||
const resolveGitRepo = async (cwd) => { | ||
const resolveGitRepo = async (cwd = process.cwd()) => { | ||
try { | ||
@@ -42,3 +52,6 @@ debugLog('Resolving git repo from `%s`', cwd) | ||
const gitDir = normalize(await execGit(['rev-parse', '--show-toplevel'], { cwd })) | ||
// read the path of the current directory relative to the top-level directory | ||
// don't read the toplevel directly, it will lead to an posix conform path on non posix systems (cygwin) | ||
const gitRel = normalize(await execGit(['rev-parse', '--show-prefix'])) | ||
const gitDir = determineGitDir(cwd, gitRel) | ||
const gitConfigDir = normalize(await resolveGitConfigDir(gitDir)) | ||
@@ -45,0 +58,0 @@ |
{ | ||
"name": "lint-staged", | ||
"version": "11.2.0", | ||
"version": "11.2.1", | ||
"description": "Lint files staged by git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87933
1551