File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments