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(
505505 icon : diffIcon
506506 } ) ;
507507
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+
508523 commands . addCommand ( ContextCommandIDs . gitFileStage , {
509524 label : 'Stage' ,
510525 caption : pluralizedContextLabel (
@@ -869,6 +884,13 @@ export function addFileBrowserContextMenu(
869884 command !== ContextCommandIDs . gitFileDelete &&
870885 typeof command !== 'undefined'
871886 )
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+ )
872894 ) ;
873895
874896 // 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 {
835835 * The command IDs used in the git context menus.
836836 */
837837export enum ContextCommandIDs {
838+ gitFileAdd = 'git:context-add' ,
838839 gitFileDiff = 'git:context-diff' ,
839840 gitFileDiscard = 'git:context-discard' ,
840841 gitFileDelete = 'git:context-delete' ,
You can’t perform that action at this time.
0 commit comments