Skip to content

Commit 088fa7a

Browse files
committed
fix(simple-git): updated to the modern syntax for defining the repo root
1 parent 3f89ad9 commit 088fa7a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/vcs/git/git.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function getExistingRemotes(git) {
3030
}
3131

3232
async function defineRemoteOrigin(projectRoot, origin) {
33-
const git = simpleGit(projectRoot);
33+
const git = simpleGit({baseDir: projectRoot});
3434
const existingRemotes = await getExistingRemotes(git);
3535

3636
if (existingRemotes.includes('origin')) {
@@ -68,7 +68,7 @@ export async function initialize(
6868
decisions
6969
) {
7070
if (gitRepoShouldBeInitialized) {
71-
const git = simpleGit(projectRoot);
71+
const git = simpleGit({baseDir: projectRoot});
7272
if (await git.checkIsRepo('root')) {
7373
info('Git repository already exists');
7474

src/vcs/git/git.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('git', () => {
3131
addRemote = vi.fn();
3232

3333
when(simpleGit.simpleGit)
34-
.calledWith(projectRoot)
34+
.calledWith({baseDir: projectRoot})
3535
.mockReturnValue({checkIsRepo, init, remote, listRemote, addRemote});
3636
});
3737

test/integration/features/step_definitions/vcs/git-steps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Given(/^the project should be versioned in git$/, async function () {
1717
this.setAnswerFor(questionNames.GIT_REPO, true);
1818
this.setAnswerFor(questionNames.REPO_HOST, 'Other');
1919

20-
td.when(this.git.simpleGit(process.cwd())).thenReturn(simpleGitInstance);
20+
td.when(this.git.simpleGit({baseDir: process.cwd()})).thenReturn(simpleGitInstance);
2121
td.when(simpleGitInstance.checkIsRepo('root')).thenResolve(false);
2222
td.when(simpleGitInstance.listRemote())
2323
.thenReject(new GitError(null, 'fatal: No remote configured to list refs from.\n'));
@@ -39,7 +39,7 @@ Given('the project root is already initialized as a git repository', async funct
3939
this.setAnswerFor(questionNames.GIT_REPO, true);
4040
this.setAnswerFor(questionNames.REPO_HOST, undefined);
4141

42-
td.when(this.git.simpleGit(process.cwd())).thenReturn(simpleGitInstance);
42+
td.when(this.git.simpleGit({baseDir: process.cwd()})).thenReturn(simpleGitInstance);
4343
td.when(simpleGitInstance.checkIsRepo('root')).thenResolve(true);
4444
td.when(simpleGitInstance.listRemote()).thenResolve(['origin']);
4545
td.when(simpleGitInstance.remote(['get-url', 'origin']))

0 commit comments

Comments
 (0)