lint-staged 10.2.7 → 10.2.11
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/execGit.js +12 -1
- package/lib/resolveGitRepo.js +2 -0
- package/lib/runAll.js +1 -0
- package/package.json +3 -2
package/lib/execGit.js
CHANGED
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
const debug = require('debug')('lint-staged:git')
|
|
4
4
|
const execa = require('execa')
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Explicitly never recurse commands into submodules, overriding local/global configuration.
|
|
8
|
+
* @see https://git-scm.com/docs/git-config#Documentation/git-config.txt-submodulerecurse
|
|
9
|
+
*/
|
|
10
|
+
const NO_SUBMODULE_RECURSE = ['-c', 'submodule.recurse=false']
|
|
11
|
+
|
|
12
|
+
const GIT_GLOBAL_OPTIONS = [...NO_SUBMODULE_RECURSE]
|
|
13
|
+
|
|
6
14
|
module.exports = async function execGit(cmd, options = {}) {
|
|
7
15
|
debug('Running git command', cmd)
|
|
8
16
|
try {
|
|
9
|
-
const { stdout } = await execa('git',
|
|
17
|
+
const { stdout } = await execa('git', GIT_GLOBAL_OPTIONS.concat(cmd), {
|
|
10
18
|
...options,
|
|
11
19
|
all: true,
|
|
12
20
|
cwd: options.cwd || process.cwd(),
|
|
@@ -16,3 +24,6 @@ module.exports = async function execGit(cmd, options = {}) {
|
|
|
16
24
|
throw new Error(all)
|
|
17
25
|
}
|
|
18
26
|
}
|
|
27
|
+
|
|
28
|
+
// exported for tests
|
|
29
|
+
module.exports.GIT_GLOBAL_OPTIONS = GIT_GLOBAL_OPTIONS
|
package/lib/resolveGitRepo.js
CHANGED
|
@@ -35,6 +35,8 @@ const resolveGitRepo = async (cwd) => {
|
|
|
35
35
|
// Unset GIT_DIR before running any git operations in case it's pointing to an incorrect location
|
|
36
36
|
debugLog('Unset GIT_DIR (was `%s`)', process.env.GIT_DIR)
|
|
37
37
|
delete process.env.GIT_DIR
|
|
38
|
+
debugLog('Unset GIT_WORK_TREE (was `%s`)', process.env.GIT_WORK_TREE)
|
|
39
|
+
delete process.env.GIT_WORK_TREE
|
|
38
40
|
|
|
39
41
|
const gitDir = normalize(await execGit(['rev-parse', '--show-toplevel'], { cwd }))
|
|
40
42
|
const gitConfigDir = normalize(await resolveGitConfigDir(gitDir))
|
package/lib/runAll.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-staged",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.11",
|
|
4
4
|
"description": "Lint files staged by git",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/okonet/lint-staged",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"cosmiconfig": "^6.0.0",
|
|
39
39
|
"debug": "^4.1.1",
|
|
40
40
|
"dedent": "^0.7.0",
|
|
41
|
+
"enquirer": "^2.3.5",
|
|
41
42
|
"execa": "^4.0.1",
|
|
42
|
-
"listr2": "^2.0
|
|
43
|
+
"listr2": "^2.1.0",
|
|
43
44
|
"log-symbols": "^4.0.0",
|
|
44
45
|
"micromatch": "^4.0.2",
|
|
45
46
|
"normalize-path": "^3.0.0",
|