Bläddra i källkod

Fixes #1372 - honors git.autoRepositoryDetection

At least for causing repos to show up in the built-in git views
main
Eric Amodio 3 år sedan
förälder
incheckning
fabe92fb45
3 ändrade filer med 12 tillägg och 2 borttagningar
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      src/constants.ts
  3. +10
    -2
      src/git/gitService.ts

+ 1
- 0
CHANGELOG.md Visa fil

@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [1372](https://github.com/eamodio/vscode-gitlens/issues/1372) - Unexpected repository detection on editor startup after recent updates
- Fixes [1394](https://github.com/eamodio/vscode-gitlens/issues/1394) - Repository view settings appear disabled
- Fixes [1391](https://github.com/eamodio/vscode-gitlens/issues/1391) - Branch names are not properly escaped in git commands
- Fixes [1336](https://github.com/eamodio/vscode-gitlens/issues/1336) - Need to allow GitLens to connect to GitHub in every Codespace (requires VS Code v1.54-insiders or later)

+ 1
- 0
src/constants.ts Visa fil

@ -37,6 +37,7 @@ export enum BuiltInGitCommands {
}
export enum BuiltInGitConfiguration {
AutoRepositoryDetection = 'git.autoRepositoryDetection',
FetchOnPull = 'git.fetchOnPull',
UseForcePushWithLease = 'git.useForcePushWithLease',
}

+ 10
- 2
src/git/gitService.ts Visa fil

@ -23,7 +23,7 @@ import {
import { API as BuiltInGitApi, Repository as BuiltInGitRepository, GitExtension } from '../@types/git';
import { resetAvatarCache } from '../avatars';
import { BranchSorting, configuration, TagSorting } from '../configuration';
import { ContextKeys, DocumentSchemes, GlyphChars, setContext } from '../constants';
import { BuiltInGitConfiguration, ContextKeys, DocumentSchemes, GlyphChars, setContext } from '../constants';
import { Container } from '../container';
import { setEnabled } from '../extension';
import {
@ -267,6 +267,12 @@ export class GitService implements Disposable {
Logger.log(`Starting repository search in ${e.added.length} folders`);
}
const autoRepositoryDetection =
configuration.getAny<boolean | 'subFolders' | 'openEditors'>(
BuiltInGitConfiguration.AutoRepositoryDetection,
) ?? true;
if (autoRepositoryDetection === false) return;
for (const f of e.added) {
const { scheme } = f.uri;
if (scheme !== DocumentSchemes.File && scheme !== DocumentSchemes.Vsls) continue;
@ -294,7 +300,9 @@ export class GitService implements Disposable {
this._repositoryTree.set(r.path, r);
}
void GitService.openBuiltInGitRepository(r.path);
if (autoRepositoryDetection === true || autoRepositoryDetection === 'subFolders') {
void GitService.openBuiltInGitRepository(r.path);
}
}
}
}

Laddar…
Avbryt
Spara