Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 95fe919

Browse files
refactor: change to use diff instead of status
1 parent 44db876 commit 95fe919

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/git.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export class Git {
99
}
1010

1111
static async add() {
12-
const { stdout: hasStaged } = await this.status(['--porcelain','--untracked-files=no']);
12+
const { stdout: changes } = await this.diff(['--cached']);
1313

14-
if (!hasStaged) {
14+
if (changes.length===0) {
1515
return this.execute(getWorkspaceFolder(), 'add', [`--all`]);
1616
}
1717
}
@@ -24,7 +24,7 @@ export class Git {
2424
return exec(`git ${command} ${options.join(' ')}`, { cwd });
2525
}
2626

27-
private static async status(options: string[] = []) {
28-
return this.execute(getWorkspaceFolder(), 'status', [...options]);
27+
private static async diff(options: string[] = []) {
28+
return this.execute(getWorkspaceFolder(), 'diff', [...options]);
2929
}
3030
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /