Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show warning for a long commit message #7399

Merged
merged 1 commit into from
Jun 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/vs/workbench/parts/git/browser/views/changes/changesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
private static COMMIT_KEYBINDING = Platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter';
private static NEED_MESSAGE = nls.localize('needMessage', "Please provide a commit message. You can always press **{0}** to commit changes. If there are any staged changes, only those will be committed; otherwise, all changes will.", ChangesView.COMMIT_KEYBINDING);
private static NOTHING_TO_COMMIT = nls.localize('nothingToCommit', "Once there are some changes to commit, type in the commit message and either press **{0}** to commit changes. If there are any staged changes, only those will be committed; otherwise, all changes will.", ChangesView.COMMIT_KEYBINDING);
private static LONG_COMMIT = nls.localize('longCommit', "Great commit summaries are 50 characters or less. Place extra information in next lines.");

private instantiationService: IInstantiationService;
private editorService: IWorkbenchEditorService;
Expand Down Expand Up @@ -132,7 +133,15 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV
placeholder: nls.localize('commitMessage', "Message (press {0} to commit)", ChangesView.COMMIT_KEYBINDING),
validationOptions: {
showMessage: true,
validation: (): InputBox.IMessage => null
validation: (value): InputBox.IMessage => {
if (Strings.trim(value.split('\n')[0]).length > 50) {
return {
content: ChangesView.LONG_COMMIT,
type: InputBox.MessageType.WARNING
};
}
return null;
}
},
ariaLabel: nls.localize('commitMessageAriaLabel', "Git: Type commit message and press {0} to commit", ChangesView.COMMIT_KEYBINDING),
flexibleHeight: true
Expand Down