We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
diff
status
1 parent 44db876 commit 95fe919Copy full SHA for 95fe919
src/git.ts
@@ -9,9 +9,9 @@ export class Git {
9
}
10
11
static async add() {
12
- const { stdout: hasStaged } = await this.status(['--porcelain', '--untracked-files=no']);
+ const { stdout: changes } = await this.diff(['--cached']);
13
14
- if (!hasStaged) {
+ if (changes.length === 0) {
15
return this.execute(getWorkspaceFolder(), 'add', [`--all`]);
16
17
@@ -24,7 +24,7 @@ export class Git {
24
return exec(`git ${command} ${options.join(' ')}`, { cwd });
25
26
27
- private static async status(options: string[] = []) {
28
- return this.execute(getWorkspaceFolder(), 'status', [...options]);
+ private static async diff(options: string[] = []) {
+ return this.execute(getWorkspaceFolder(), 'diff', [...options]);
29
30
0 commit comments