fix: --all flag to only stage tracked files
This commit is contained in:
@@ -27,7 +27,8 @@ export default async (
|
|||||||
const detectingFiles = spinner();
|
const detectingFiles = spinner();
|
||||||
|
|
||||||
if (stageAll) {
|
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');
|
detectingFiles.start('Detecting staged files');
|
||||||
|
|||||||
@@ -98,10 +98,11 @@ export default testSuite(({ describe }) => {
|
|||||||
await git('add', ['data.json']);
|
await git('add', ['data.json']);
|
||||||
await git('commit', ['-m', 'wip']);
|
await git('commit', ['-m', 'wip']);
|
||||||
|
|
||||||
|
// Change tracked file
|
||||||
await fixture.writeFile('data.json', 'Test');
|
await fixture.writeFile('data.json', 'Test');
|
||||||
|
|
||||||
const statusBefore = await git('status', ['--short', '--untracked-files=no']);
|
const statusBefore = await git('status', ['--short']);
|
||||||
expect(statusBefore.stdout).toBe(' M data.json');
|
expect(statusBefore.stdout).toBe(' M data.json\n?? .aicommits');
|
||||||
|
|
||||||
const committing = aicommits(['--all']);
|
const committing = aicommits(['--all']);
|
||||||
committing.stdout!.on('data', (buffer: Buffer) => {
|
committing.stdout!.on('data', (buffer: Buffer) => {
|
||||||
@@ -114,8 +115,8 @@ export default testSuite(({ describe }) => {
|
|||||||
|
|
||||||
await committing;
|
await committing;
|
||||||
|
|
||||||
const statusAfter = await git('status', ['--short', '--untracked-files=no']);
|
const statusAfter = await git('status', ['--short']);
|
||||||
expect(statusAfter.stdout).toBe('');
|
expect(statusAfter.stdout).toBe('?? .aicommits');
|
||||||
|
|
||||||
const { stdout: commitMessage } = await git('log', ['-n1', '--pretty=format:%s']);
|
const { stdout: commitMessage } = await git('log', ['-n1', '--pretty=format:%s']);
|
||||||
console.log({
|
console.log({
|
||||||
|
|||||||
Reference in New Issue
Block a user