File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,21 @@ export function addCommands(
505
505
icon : diffIcon
506
506
} ) ;
507
507
508
+ commands . addCommand ( ContextCommandIDs . gitFileAdd , {
509
+ label : 'Add' ,
510
+ caption : pluralizedContextLabel (
511
+ 'Stage or track the changes to selected file' ,
512
+ 'Stage or track the changes of selected files'
513
+ ) ,
514
+ execute : async args => {
515
+ const { files } = ( args as any ) as CommandArguments . IGitContextAction ;
516
+ for ( const file of files ) {
517
+ await model . add ( file . to ) ;
518
+ }
519
+ } ,
520
+ icon : addIcon
521
+ } ) ;
522
+
508
523
commands . addCommand ( ContextCommandIDs . gitFileStage , {
509
524
label : 'Stage' ,
510
525
caption : pluralizedContextLabel (
@@ -869,6 +884,13 @@ export function addFileBrowserContextMenu(
869
884
command !== ContextCommandIDs . gitFileDelete &&
870
885
typeof command !== 'undefined'
871
886
)
887
+ // replace stage and track with a single "add" operation
888
+ . map ( command =>
889
+ command === ContextCommandIDs . gitFileStage ||
890
+ command === ContextCommandIDs . gitFileTrack
891
+ ? ContextCommandIDs . gitFileAdd
892
+ : command
893
+ )
872
894
) ;
873
895
874
896
// if looking at a tracked file with no changes,
Original file line number Diff line number Diff line change @@ -835,6 +835,7 @@ export interface ILogMessage {
835
835
* The command IDs used in the git context menus.
836
836
*/
837
837
export enum ContextCommandIDs {
838
+ gitFileAdd = 'git:context-add' ,
838
839
gitFileDiff = 'git:context-diff' ,
839
840
gitFileDiscard = 'git:context-discard' ,
840
841
gitFileDelete = 'git:context-delete' ,
You can’t perform that action at this time.
0 commit comments