Skip to content

Commit

Permalink
Closes #2877 adds setting to cache git path
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Dec 10, 2024
1 parent 4d2e632 commit cdf398f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds Holiday promotion
- Adds the ability to get autolinks for branches via the branch name — closes [#3547](https://github.com/gitkraken/vscode-gitlens/issues/3547)
- Adds GitLab issues to the issues list in the _Start Work_ command when GitLab is connected — closes [#3779](https://github.com/gitkraken/vscode-gitlens/issues/3779)
- Adds `gitlens.advanced.caching.gitPath` setting to specify whether to cache the git path — closes [#2877](https://github.com/gitkraken/vscode-gitlens/issues/2877)

### Changed

- Updates prep-release reference - Thanks to [PR #3732](https://github.com/gitkraken/vscode-gitlens/pull/3732) by Emmanuel Ferdman ([@emmanuel-ferdman](https://github.com/emmanuel-ferdman))
- Updates prep-release reference — thanks to [PR #3732](https://github.com/gitkraken/vscode-gitlens/pull/3732) by Emmanuel Ferdman ([@emmanuel-ferdman](https://github.com/emmanuel-ferdman))

## [16.0.4] - 2024-11-25

Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4945,6 +4945,13 @@
"scope": "window",
"order": 90
},
"gitlens.advanced.caching.gitPath": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to cache (per-workspace) the path to the Git executable to use for GitLens",
"scope": "window",
"order": 91
},
"gitlens.debug": {
"type": "boolean",
"default": false,
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export interface AdvancedConfig {
};
readonly caching: {
readonly enabled: boolean;
readonly gitPath: boolean;
};
readonly commitOrdering: 'date' | 'author-date' | 'topo' | null;
readonly externalDiffTool: string | null;
Expand Down
13 changes: 11 additions & 2 deletions src/env/node/git/localGitProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
void subscribeToScmOpenCloseRepository.call(this);

const potentialGitPaths = configuration.getCore('git.path') ?? this.container.storage.getWorkspace('gitPath');
const canCacheGitPath = configuration.get('advanced.caching.gitPath');
const potentialGitPaths =
configuration.getCore('git.path') ??
(canCacheGitPath ? this.container.storage.getWorkspace('gitPath') : undefined);

const start = hrtime();

Expand All @@ -467,7 +470,13 @@ export class LocalGitProvider implements GitProvider, Disposable {

const location = await any<GitLocation>(findGitPromise, findGitFromSCMPromise);
// Save the found git path, but let things settle first to not impact startup performance
setTimeout(() => void this.container.storage.storeWorkspace('gitPath', location.path).catch(), 1000);
setTimeout(
() =>
void this.container.storage
.storeWorkspace('gitPath', canCacheGitPath ? location.path : undefined)
.catch(),
1000,
);

if (scope != null) {
setLogScopeExit(
Expand Down

0 comments on commit cdf398f

Please sign in to comment.