@@ -1016,6 +1016,28 @@ define(function (require, exports) {
10161016 } ) ;
10171017 }
10181018
1019+ const OPEN_ALL_CONFIRM_THRESHOLD = 50 ;
1020+
1021+ function _openChangedFiles ( files ) {
1022+ const currentGitRoot = Preferences . get ( "currentGitRoot" ) ;
1023+ // addListToWorkingSet ignores files already present in any pane, so this is safe
1024+ // to run repeatedly or with some of the files already open
1025+ const fileList = files . map ( function ( file ) {
1026+ return FileSystem . getFileForPath ( currentGitRoot + file . file ) ;
1027+ } ) ;
1028+ MainViewManager . addListToWorkingSet ( MainViewManager . ACTIVE_PANE , fileList ) ;
1029+
1030+ // if the user is already viewing one of the changed files, we don't switch the file then...
1031+ // if user is viewing a un-changed file, then we switch to the first changed file
1032+ const currentPath = MainViewManager . getCurrentlyViewedPath ( MainViewManager . ACTIVE_PANE ) ;
1033+ const viewingChangedFile = _ . any ( fileList , function ( file ) {
1034+ return file . fullPath === currentPath ;
1035+ } ) ;
1036+ if ( ! viewingChangedFile ) {
1037+ CommandManager . execute ( Commands . FILE_OPEN , { fullPath : fileList [ 0 ] . fullPath } ) ;
1038+ }
1039+ }
1040+
10191041 function openAllChangedFiles ( ) {
10201042 return Git . status ( ) . then ( function ( files ) {
10211043 files = _ . filter ( files , function ( file ) {
@@ -1037,23 +1059,18 @@ define(function (require, exports) {
10371059 return ;
10381060 }
10391061
1040- const currentGitRoot = Preferences . get ( "currentGitRoot" ) ;
1041- // addListToWorkingSet ignores files already present in any pane, so this is safe
1042- // to run repeatedly or with some of the files already open
1043- const fileList = files . map ( function ( file ) {
1044- return FileSystem . getFileForPath ( currentGitRoot + file . file ) ;
1045- } ) ;
1046- MainViewManager . addListToWorkingSet ( MainViewManager . ACTIVE_PANE , fileList ) ;
1047-
1048- // if the user is already viewing one of the changed files, we don't switch the file then...
1049- // if user is viewing a un-changed file, then we switch to the first changed file
1050- const currentPath = MainViewManager . getCurrentlyViewedPath ( MainViewManager . ACTIVE_PANE ) ;
1051- const viewingChangedFile = _ . any ( fileList , function ( file ) {
1052- return file . fullPath === currentPath ;
1053- } ) ;
1054- if ( ! viewingChangedFile ) {
1055- CommandManager . execute ( Commands . FILE_OPEN , { fullPath : fileList [ 0 ] . fullPath } ) ;
1062+ if ( files . length > OPEN_ALL_CONFIRM_THRESHOLD ) {
1063+ return Utils . askQuestion ( Strings . CMD_OPEN_CHANGED_FILES ,
1064+ StringUtils . format ( Strings . OPEN_CHANGED_FILES_CONFIRM , files . length ) ,
1065+ { booleanResponse : true } )
1066+ . then ( function ( response ) {
1067+ if ( response === true ) {
1068+ _openChangedFiles ( files ) ;
1069+ }
1070+ } ) ;
10561071 }
1072+
1073+ _openChangedFiles ( files ) ;
10571074 } ) . catch ( function ( err ) {
10581075 ErrorHandler . showError ( err , Strings . ERROR_OPENING_CHANGED_FILES ) ;
10591076 } ) ;
0 commit comments