mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Fixes #129669: new setting to control status limit
Also bumps the default from 5000 to 10,000
This commit is contained in:
parent
6fed60f8f4
commit
2306ad1ef4
|
@ -2162,6 +2162,12 @@
|
|||
"default": "whenEmpty",
|
||||
"description": "%config.showUnpublishedCommitsButton%",
|
||||
"scope": "resource"
|
||||
},
|
||||
"git.statusLimit": {
|
||||
"type": "number",
|
||||
"scope": "resource",
|
||||
"default": 5000,
|
||||
"description": "%config.statusLimit%"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
"config.showUnpublishedCommitsButton.always": "Always shows the action button, if there are unpublished commits.",
|
||||
"config.showUnpublishedCommitsButton.whenEmpty": "Only shows the action button if there are no other changes and there are unpublished commits.",
|
||||
"config.showUnpublishedCommitsButton.never": "Never shows the action button.",
|
||||
"config.statusLimit": "Controls how to limit the number of changes that can be parsed from Git status command. Can be set to 0 for no limit.",
|
||||
"submenu.explorer": "Git",
|
||||
"submenu.commit": "Commit",
|
||||
"submenu.commit.amend": "Amend",
|
||||
|
|
|
@ -1842,7 +1842,7 @@ export class Repository {
|
|||
const onStdoutData = (raw: string) => {
|
||||
parser.update(raw);
|
||||
|
||||
if (parser.status.length > limit) {
|
||||
if (limit !== 0 && parser.status.length > limit) {
|
||||
child.removeListener('exit', onExit);
|
||||
child.stdout!.removeListener('data', onStdoutData);
|
||||
child.kill();
|
||||
|
|
|
@ -842,7 +842,7 @@ export class Repository implements Disposable {
|
|||
return this.repository.dotGit;
|
||||
}
|
||||
|
||||
private isRepositoryHuge = false;
|
||||
private isRepositoryHuge: false | { limit: number } = false;
|
||||
private didWarnAboutLimit = false;
|
||||
|
||||
private resourceCommandResolver = new ResourceCommandResolver(this);
|
||||
|
@ -973,6 +973,14 @@ export class Repository implements Disposable {
|
|||
}
|
||||
|
||||
validateInput(text: string, position: number): SourceControlInputBoxValidation | undefined {
|
||||
let tooManyChangesWarning: SourceControlInputBoxValidation | undefined;
|
||||
if (this.isRepositoryHuge) {
|
||||
tooManyChangesWarning = {
|
||||
message: localize('tooManyChangesWarning', "Too many changes were detected. Only the first {0} changes will be shown below.", this.isRepositoryHuge.limit),
|
||||
type: SourceControlInputBoxValidationType.Warning
|
||||
};
|
||||
}
|
||||
|
||||
if (this.rebaseCommit) {
|
||||
if (this.rebaseCommit.message !== text) {
|
||||
return {
|
||||
|
@ -986,7 +994,7 @@ export class Repository implements Disposable {
|
|||
const setting = config.get<'always' | 'warn' | 'off'>('inputValidation');
|
||||
|
||||
if (setting === 'off') {
|
||||
return;
|
||||
return tooManyChangesWarning;
|
||||
}
|
||||
|
||||
if (/^\s+$/.test(text)) {
|
||||
|
@ -1022,7 +1030,7 @@ export class Repository implements Disposable {
|
|||
|
||||
if (line.length <= threshold) {
|
||||
if (setting !== 'always') {
|
||||
return;
|
||||
return tooManyChangesWarning;
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1792,12 +1800,16 @@ export class Repository implements Disposable {
|
|||
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
|
||||
const ignoreSubmodules = scopedConfig.get<boolean>('ignoreSubmodules');
|
||||
|
||||
const { status, didHitLimit } = await this.repository.getStatus({ ignoreSubmodules });
|
||||
const limit = scopedConfig.get<number>('statusLimit', 5000);
|
||||
|
||||
const { status, didHitLimit } = await this.repository.getStatus({ limit, ignoreSubmodules });
|
||||
|
||||
const config = workspace.getConfiguration('git');
|
||||
const shouldIgnore = config.get<boolean>('ignoreLimitWarning') === true;
|
||||
const useIcons = !config.get<boolean>('decorations.enabled', true);
|
||||
this.isRepositoryHuge = didHitLimit;
|
||||
this.isRepositoryHuge = didHitLimit ? { limit } : false;
|
||||
// Triggers or clears any validation warning
|
||||
this._sourceControl.inputBox.validateInput = this._sourceControl.inputBox.validateInput;
|
||||
|
||||
if (didHitLimit && !shouldIgnore && !this.didWarnAboutLimit) {
|
||||
const knownHugeFolderPaths = await this.findKnownHugeFolderPathsToIgnore();
|
||||
|
@ -1810,18 +1822,21 @@ export class Repository implements Disposable {
|
|||
|
||||
const addKnown = localize('add known', "Would you like to add '{0}' to .gitignore?", folderName);
|
||||
const yes = { title: localize('yes', "Yes") };
|
||||
const no = { title: localize('no', "No") };
|
||||
|
||||
const result = await window.showWarningMessage(`${gitWarn} ${addKnown}`, yes, neverAgain);
|
||||
|
||||
if (result === neverAgain) {
|
||||
config.update('ignoreLimitWarning', true, false);
|
||||
this.didWarnAboutLimit = true;
|
||||
} else if (result === yes) {
|
||||
const result = await window.showWarningMessage(`${gitWarn} ${addKnown}`, yes, no, neverAgain);
|
||||
if (result === yes) {
|
||||
this.ignore([Uri.file(folderPath)]);
|
||||
} else {
|
||||
if (result === neverAgain) {
|
||||
config.update('ignoreLimitWarning', true, false);
|
||||
}
|
||||
|
||||
this.didWarnAboutLimit = true;
|
||||
}
|
||||
} else {
|
||||
const result = await window.showWarningMessage(gitWarn, neverAgain);
|
||||
|
||||
const ok = { title: localize('ok', "OK") };
|
||||
const result = await window.showWarningMessage(gitWarn, ok, neverAgain);
|
||||
if (result === neverAgain) {
|
||||
config.update('ignoreLimitWarning', true, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue