Skip to content

Commit 7f78f7a

Browse files
committed
Adds error message for #318
1 parent 3ac3139 commit 7f78f7a

File tree

7 files changed

+789
-773
lines changed

7 files changed

+789
-773
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
### Added
9+
- Adds a visible error message for when Git is disabled (`"git.enabled": false`) — for [#318](https://github.com/eamodio/vscode-gitlens/issues/318)
10+
711
## [8.2.3] - 2018-04-21
812
### Fixed
913
- Fixes [#313](https://github.com/eamodio/vscode-gitlens/issues/313) - Unable to show branch history for branch that matches file or folder name

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@
10191019
"suppressCommitHasNoPreviousCommitWarning": false,
10201020
"suppressCommitNotFoundWarning": false,
10211021
"suppressFileNotUnderSourceControlWarning": false,
1022+
"suppressGitDisabledWarning": false,
10221023
"suppressGitVersionWarning": false,
10231024
"suppressLineUncommittedWarning": false,
10241025
"suppressNoRepositoryWarning": false,
@@ -1038,6 +1039,10 @@
10381039
"type": "boolean",
10391040
"default": false
10401041
},
1042+
"suppressGitDisabledWarning": {
1043+
"type": "boolean",
1044+
"default": false
1045+
},
10411046
"suppressGitVersionWarning": {
10421047
"type": "boolean",
10431048
"default": false

src/extension.ts

Lines changed: 275 additions & 275 deletions
Large diffs are not rendered by default.

src/messages.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export enum SuppressedMessages {
99
CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning',
1010
CommitNotFoundWarning = 'suppressCommitNotFoundWarning',
1111
FileNotUnderSourceControlWarning = 'suppressFileNotUnderSourceControlWarning',
12+
GitDisabledWarning = 'suppressGitDisabledWarning',
1213
GitVersionWarning = 'suppressGitVersionWarning',
1314
LineUncommittedWarning = 'suppressLineUncommittedWarning',
1415
NoRepositoryWarning = 'suppressNoRepositoryWarning',
@@ -31,6 +32,14 @@ export class Messages {
3132
return Messages.showMessage('warn', `${message}. The file is probably not under source control.`, SuppressedMessages.FileNotUnderSourceControlWarning);
3233
}
3334

35+
static showGitDisabledErrorMessage() {
36+
return Messages.showMessage('error', `GitLens requires Git to be enabled. Please re-enable Git \u2014 set \`git.enabled\` to true and reload`, SuppressedMessages.GitDisabledWarning);
37+
}
38+
39+
static showGitVersionUnsupportedErrorMessage(version: string): Promise<MessageItem | undefined> {
40+
return Messages.showMessage('error', `GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git.`, SuppressedMessages.GitVersionWarning);
41+
}
42+
3443
static async showKeyBindingsInfoMessage(): Promise<MessageItem | undefined> {
3544
if (Container.config.advanced.messages.suppressShowKeyBindingsNotice) return undefined;
3645

@@ -78,10 +87,6 @@ export class Messages {
7887
return Messages.showMessage('info', `If you can't find your results, click on "GITLENS RESULTS" at the bottom of the Explorer view.`, SuppressedMessages.ResultsExplorerNotice, null);
7988
}
8089

81-
static showUnsupportedGitVersionErrorMessage(version: string): Promise<MessageItem | undefined> {
82-
return Messages.showMessage('error', `GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git.`, SuppressedMessages.GitVersionWarning);
83-
}
84-
8590
private static async showMessage<T extends MessageItem>(type: 'info' | 'warn' | 'error', message: string, suppressionKey: SuppressedMessages, dontShowAgain: T | null = { title: 'Don\'t Show Again' } as T, ...actions: T[]): Promise<T | undefined> {
8691
Logger.log(`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain})`);
8792

0 commit comments

Comments
 (0)