@@ -842,7 +842,7 @@ export class Repository implements Disposable {
842
842
return this . repository . dotGit ;
843
843
}
844
844
845
- private isRepositoryHuge = false ;
845
+ private isRepositoryHuge : false | { limit : number } = false ;
846
846
private didWarnAboutLimit = false ;
847
847
848
848
private resourceCommandResolver = new ResourceCommandResolver ( this ) ;
@@ -973,6 +973,14 @@ export class Repository implements Disposable {
973
973
}
974
974
975
975
validateInput ( text : string , position : number ) : SourceControlInputBoxValidation | undefined {
976
+ let tooManyChangesWarning : SourceControlInputBoxValidation | undefined ;
977
+ if ( this . isRepositoryHuge ) {
978
+ tooManyChangesWarning = {
979
+ message : localize ( 'tooManyChangesWarning' , "Too many changes were detected. Only the first {0} changes will be shown below." , this . isRepositoryHuge . limit ) ,
980
+ type : SourceControlInputBoxValidationType . Warning
981
+ } ;
982
+ }
983
+
976
984
if ( this . rebaseCommit ) {
977
985
if ( this . rebaseCommit . message !== text ) {
978
986
return {
@@ -986,7 +994,7 @@ export class Repository implements Disposable {
986
994
const setting = config . get < 'always' | 'warn' | 'off' > ( 'inputValidation' ) ;
987
995
988
996
if ( setting === 'off' ) {
989
- return ;
997
+ return tooManyChangesWarning ;
990
998
}
991
999
992
1000
if ( / ^ \s + $ / . test ( text ) ) {
@@ -1022,7 +1030,7 @@ export class Repository implements Disposable {
1022
1030
1023
1031
if ( line . length <= threshold ) {
1024
1032
if ( setting !== 'always' ) {
1025
- return ;
1033
+ return tooManyChangesWarning ;
1026
1034
}
1027
1035
1028
1036
return {
@@ -1792,12 +1800,16 @@ export class Repository implements Disposable {
1792
1800
const scopedConfig = workspace . getConfiguration ( 'git' , Uri . file ( this . repository . root ) ) ;
1793
1801
const ignoreSubmodules = scopedConfig . get < boolean > ( 'ignoreSubmodules' ) ;
1794
1802
1795
- const { status, didHitLimit } = await this . repository . getStatus ( { ignoreSubmodules } ) ;
1803
+ const limit = scopedConfig . get < number > ( 'statusLimit' , 5000 ) ;
1804
+
1805
+ const { status, didHitLimit } = await this . repository . getStatus ( { limit, ignoreSubmodules } ) ;
1796
1806
1797
1807
const config = workspace . getConfiguration ( 'git' ) ;
1798
1808
const shouldIgnore = config . get < boolean > ( 'ignoreLimitWarning' ) === true ;
1799
1809
const useIcons = ! config . get < boolean > ( 'decorations.enabled' , true ) ;
1800
- this . isRepositoryHuge = didHitLimit ;
1810
+ this . isRepositoryHuge = didHitLimit ? { limit } : false ;
1811
+ // Triggers or clears any validation warning
1812
+ this . _sourceControl . inputBox . validateInput = this . _sourceControl . inputBox . validateInput ;
1801
1813
1802
1814
if ( didHitLimit && ! shouldIgnore && ! this . didWarnAboutLimit ) {
1803
1815
const knownHugeFolderPaths = await this . findKnownHugeFolderPathsToIgnore ( ) ;
@@ -1810,18 +1822,21 @@ export class Repository implements Disposable {
1810
1822
1811
1823
const addKnown = localize ( 'add known' , "Would you like to add '{0}' to .gitignore?" , folderName ) ;
1812
1824
const yes = { title : localize ( 'yes' , "Yes" ) } ;
1825
+ const no = { title : localize ( 'no' , "No" ) } ;
1813
1826
1814
- const result = await window . showWarningMessage ( `${ gitWarn } ${ addKnown } ` , yes , neverAgain ) ;
1827
+ const result = await window . showWarningMessage ( `${ gitWarn } ${ addKnown } ` , yes , no , neverAgain ) ;
1828
+ if ( result === yes ) {
1829
+ this . ignore ( [ Uri . file ( folderPath ) ] ) ;
1830
+ } else {
1831
+ if ( result === neverAgain ) {
1832
+ config . update ( 'ignoreLimitWarning' , true , false ) ;
1833
+ }
1815
1834
1816
- if ( result === neverAgain ) {
1817
- config . update ( 'ignoreLimitWarning' , true , false ) ;
1818
1835
this . didWarnAboutLimit = true ;
1819
- } else if ( result === yes ) {
1820
- this . ignore ( [ Uri . file ( folderPath ) ] ) ;
1821
1836
}
1822
1837
} else {
1823
- const result = await window . showWarningMessage ( gitWarn , neverAgain ) ;
1824
-
1838
+ const ok = { title : localize ( 'ok' , "OK" ) } ;
1839
+ const result = await window . showWarningMessage ( gitWarn , ok , neverAgain ) ;
1825
1840
if ( result === neverAgain ) {
1826
1841
config . update ( 'ignoreLimitWarning' , true , false ) ;
1827
1842
}
0 commit comments