From ce4bc1a7bcd102e2c1a9c086f5f0ed3f83f6cd51 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Thu, 9 Jun 2016 12:44:16 +0200 Subject: [PATCH] git.enableLongCommitWarning config option --- .../parts/git/browser/gitWorkbenchContributions.ts | 5 +++++ .../parts/git/browser/views/changes/changesView.ts | 11 ++++++++++- src/vs/workbench/parts/git/common/git.ts | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts index dedf7e8e38f..8f84641260f 100644 --- a/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts +++ b/src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts @@ -527,6 +527,11 @@ export function registerContributions(): void { type: 'boolean', description: nls.localize('gitAutoFetch', "Whether auto fetching is enabled."), default: true + }, + 'git.enableLongCommitWarning': { + type: 'boolean', + description: nls.localize('gitLongCommit', "Whether long commit messages should be warned about."), + default: true } } }); diff --git a/src/vs/workbench/parts/git/browser/views/changes/changesView.ts b/src/vs/workbench/parts/git/browser/views/changes/changesView.ts index 72babaeb1ca..909a89c4b84 100644 --- a/src/vs/workbench/parts/git/browser/views/changes/changesView.ts +++ b/src/vs/workbench/parts/git/browser/views/changes/changesView.ts @@ -40,6 +40,7 @@ import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IEventService} from 'vs/platform/event/common/event'; import {CommonKeybindings} from 'vs/base/common/keyCodes'; import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService'; +import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; import IGitService = git.IGitService; @@ -87,7 +88,8 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV @IWorkspaceContextService contextService: IWorkspaceContextService, @IGitService gitService: IGitService, @IOutputService outputService: IOutputService, - @IEventService eventService: IEventService + @IEventService eventService: IEventService, + @IConfigurationService private configurationService: IConfigurationService ) { super(); @@ -134,12 +136,19 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV validationOptions: { showMessage: true, validation: (value): InputBox.IMessage => { + const config = this.configurationService.getConfiguration('git'); + + if (!config.enableLongCommitWarning) { + return null; + } + if (Strings.trim(value.split('\n')[0]).length > 50) { return { content: ChangesView.LONG_COMMIT, type: InputBox.MessageType.WARNING }; } + return null; } }, diff --git a/src/vs/workbench/parts/git/common/git.ts b/src/vs/workbench/parts/git/common/git.ts index f8a74a83bf7..3181503da96 100644 --- a/src/vs/workbench/parts/git/common/git.ts +++ b/src/vs/workbench/parts/git/common/git.ts @@ -227,8 +227,10 @@ export var ServiceOperations = { // Service config export interface IGitConfiguration { + enabled: boolean; path: string; autofetch: boolean; + enableLongCommitWarning: boolean; } // Service interfaces -- GitLab