Skip to content

Commit dcb5e3c

Browse files
committed
Fixes #1888 better honors repo detection setting
1 parent dbaf06b commit dcb5e3c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1212

1313
### Fixed
1414

15+
- Fixes [#1888](https://github.com/gitkraken/vscode-gitlens/issues/1888) - Gitlens breaks vscode auto repository detection settings
1516
- Fixes an issue where the Visual File History wasn't correctly opening the commit file details quick pick menu
1617
- Fixes an issue where the _Open Visual File History of Active File_ command wasn't showing in the Command Palette
1718

src/env/node/git/localGitProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ export class LocalGitProvider implements GitProvider, Disposable {
376376
suspended?: boolean,
377377
closed?: boolean,
378378
): Repository {
379-
void this.openScmRepository(uri);
379+
if (!closed) {
380+
void this.openScmRepository(uri);
381+
}
382+
380383
return new Repository(
381384
this.container,
382385
this.onRepositoryChanged.bind(this),

src/git/gitProviderService.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,8 +1850,15 @@ export class GitProviderService implements Disposable {
18501850
// If this new repo is inside one of our known roots and we we don't already know about, add it
18511851
const root = this._repositories.getClosest(provider.getAbsoluteUri(uri, repoUri));
18521852

1853+
const autoRepositoryDetection =
1854+
configuration.getAny<boolean | 'subFolders' | 'openEditors'>(
1855+
CoreGitConfiguration.AutoRepositoryDetection,
1856+
) ?? true;
1857+
1858+
const closed = autoRepositoryDetection !== true && autoRepositoryDetection !== 'openEditors';
1859+
18531860
Logger.log(cc, `Repository found in '${repoUri.toString(false)}'`);
1854-
repository = provider.openRepository(root?.folder, repoUri, false);
1861+
repository = provider.openRepository(root?.folder, repoUri, false, undefined, closed);
18551862
this._repositories.add(repository);
18561863

18571864
this._pendingRepositories.delete(key);

0 commit comments

Comments
 (0)