lint-staged 10.2.10 → 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/package.json +1 -1
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
|