-
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: run all git commands with submodule.recurse=false (#888)
This explicitly prevents git commands from recursing into git submodules and thus causing issues with commands like stash or reset.
- Loading branch information
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
import path from 'path' | ||
import execa from 'execa' | ||
import execGit from '../lib/execGit' | ||
|
||
import execGit, { GIT_GLOBAL_OPTIONS } from '../lib/execGit' | ||
|
||
test('GIT_GLOBAL_OPTIONS', () => { | ||
expect(GIT_GLOBAL_OPTIONS).toMatchInlineSnapshot(` | ||
Array [ | ||
"-c", | ||
"submodule.recurse=false", | ||
] | ||
`) | ||
}) | ||
|
||
describe('execGit', () => { | ||
it('should execute git in process.cwd if working copy is not specified', async () => { | ||
const cwd = process.cwd() | ||
await execGit(['init', 'param']) | ||
expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], { all: true, cwd }) | ||
expect(execa).toHaveBeenCalledWith('git', [...GIT_GLOBAL_OPTIONS, 'init', 'param'], { | ||
all: true, | ||
cwd, | ||
}) | ||
}) | ||
|
||
it('should execute git in a given working copy', async () => { | ||
const cwd = path.join(process.cwd(), 'test', '__fixtures__') | ||
await execGit(['init', 'param'], { cwd }) | ||
expect(execa).toHaveBeenCalledWith('git', ['init', 'param'], { all: true, cwd }) | ||
expect(execa).toHaveBeenCalledWith('git', [...GIT_GLOBAL_OPTIONS, 'init', 'param'], { | ||
all: true, | ||
cwd, | ||
}) | ||
}) | ||
}) |