diff --git a/src/commands/aicommits.ts b/src/commands/aicommits.ts index 91b7092..2c6cb2b 100644 --- a/src/commands/aicommits.ts +++ b/src/commands/aicommits.ts @@ -27,7 +27,8 @@ export default async ( const detectingFiles = spinner(); if (stageAll) { - await execa('git', ['add', '--all']); + // This should be equivalent behavior to `git commit --all` + await execa('git', ['add', '--update']); } detectingFiles.start('Detecting staged files'); diff --git a/tests/specs/cli/commits.ts b/tests/specs/cli/commits.ts index 497acf6..f88916a 100644 --- a/tests/specs/cli/commits.ts +++ b/tests/specs/cli/commits.ts @@ -98,10 +98,11 @@ export default testSuite(({ describe }) => { await git('add', ['data.json']); await git('commit', ['-m', 'wip']); + // Change tracked file await fixture.writeFile('data.json', 'Test'); - const statusBefore = await git('status', ['--short', '--untracked-files=no']); - expect(statusBefore.stdout).toBe(' M data.json'); + const statusBefore = await git('status', ['--short']); + expect(statusBefore.stdout).toBe(' M data.json\n?? .aicommits'); const committing = aicommits(['--all']); committing.stdout!.on('data', (buffer: Buffer) => { @@ -114,8 +115,8 @@ export default testSuite(({ describe }) => { await committing; - const statusAfter = await git('status', ['--short', '--untracked-files=no']); - expect(statusAfter.stdout).toBe(''); + const statusAfter = await git('status', ['--short']); + expect(statusAfter.stdout).toBe('?? .aicommits'); const { stdout: commitMessage } = await git('log', ['-n1', '--pretty=format:%s']); console.log({