diff --git a/extensions/git/package.json b/extensions/git/package.json index 17812acadfbb2f0e7951066ecbee25ebd9821a55..06f15b3224693e027f46aa459d576b7c8e322fb5 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1173,9 +1173,19 @@ }, "git.inputValidationLength": { "type": "number", - "default": 72, + "default": 50, "description": "%config.inputValidationLength%" }, + "git.subjectValidationLength": { + "type": "number", + "default": 50, + "description": "%config.subjectValidationLength%" + }, + "git.bodyValidationLength": { + "type": "number", + "default": 72, + "description": "%config.bodyValidationLength%" + }, "git.detectSubmodules": { "type": "boolean", "scope": "resource", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 506f2772f54fd302561a610562de86a93e2257ae..ba13718848995a2601c9fec1e878584be0bd975b 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -98,6 +98,8 @@ "config.showPushSuccessNotification": "Controls whether to show a notification when a push is successful.", "config.inputValidation": "Controls when to show commit message input validation.", "config.inputValidationLength": "Controls the commit message length threshold for showing a warning.", + "config.subjectValidationLength": "Controls the commit message subject length threshold for showing a warning.", + "config.bodyValidationLength": "Controls the commit message body length threshold for showing a warning.", "config.detectSubmodules": "Controls whether to automatically detect git submodules.", "config.detectSubmodulesLimit": "Controls the limit of git submodules detected.", "config.alwaysShowStagedChangesResourceGroup": "Always show the Staged Changes resource group.", diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 9da2c26742c5aa67e9a0c3b9a2e306dfeef5f903..38293ef98fa43eb64740ef392f3201a3d6063f65 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -658,20 +658,20 @@ export class Repository implements Disposable { end = match ? match.index : text.length; const line = text.substring(start, end); - const threshold = Math.max(config.get('inputValidationLength') || 72, 0) || 72; + const subjectThreshold = Math.max(config.get('inputValidationLength') || 50, config.get('subjectValidationLength') || 50, 0) || 50; - if (line.length <= threshold) { + if (line.length <= subjectThreshold) { if (setting !== 'always') { return; } return { - message: localize('commitMessageCountdown', "{0} characters left in current line", threshold - line.length), + message: localize('commitMessageCountdown', "{0} characters left in current line", subjectThreshold - line.length), type: SourceControlInputBoxValidationType.Information }; } else { return { - message: localize('commitMessageWarning', "{0} characters over {1} in current line", line.length - threshold, threshold), + message: localize('commitMessageWarning', "{0} characters over {1} in current line", line.length - subjectThreshold, subjectThreshold), type: SourceControlInputBoxValidationType.Warning }; }