lint-staged 11.2.1 → 11.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/resolveGitRepo.js +8 -0
- package/package.json +1 -1
package/lib/resolveGitRepo.js
CHANGED
|
@@ -26,6 +26,11 @@ const resolveGitConfigDir = async (gitDir) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const determineGitDir = (cwd, relativeDir) => {
|
|
29
|
+
// if relative dir and cwd have different endings normalize it
|
|
30
|
+
// this happens under windows, where normalize is unable to normalize git's output
|
|
31
|
+
if (relativeDir && relativeDir.endsWith(path.sep)) {
|
|
32
|
+
relativeDir = relativeDir.slice(0, -1)
|
|
33
|
+
}
|
|
29
34
|
if (relativeDir) {
|
|
30
35
|
// the current working dir is inside the git top-level directory
|
|
31
36
|
return normalize(cwd.substring(0, cwd.lastIndexOf(relativeDir)))
|
|
@@ -65,3 +70,6 @@ const resolveGitRepo = async (cwd = process.cwd()) => {
|
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
module.exports = resolveGitRepo
|
|
73
|
+
|
|
74
|
+
// exported for test
|
|
75
|
+
module.exports.determineGitDir = determineGitDir
|