Skip to content

Commit

Permalink
show warning when a user enters only whitespaces in the commit messag…
Browse files Browse the repository at this point in the history
…e box
  • Loading branch information
gnijuohz committed Mar 15, 2018
1 parent a406976 commit 231ce0c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,15 @@ export class Repository implements Disposable {
return;
}

const whitespacesOnly = text.length && !text.replace(/\s/g, '');

if (whitespacesOnly) {
return {
message: localize('commitMessageWhitespacesOnlyWarning', "Current commit message only contains whitespaces"),
type: SourceControlInputBoxValidationType.Warning
};
}

let start = 0, end;
let match: RegExpExecArray | null;
const regex = /\r?\n/g;
Expand Down

0 comments on commit 231ce0c

Please sign in to comment.