Browse Source

Caches git dir path in repo

main
Eric Amodio 1 year ago
parent
commit
c3014f48fc
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/git/models/repository.ts

+ 10
- 2
src/git/models/repository.ts View File

@ -20,7 +20,7 @@ import { updateRecordValue } from '../../system/object';
import { basename, normalizePath } from '../../system/path'; import { basename, normalizePath } from '../../system/path';
import { md5 } from '../../system/string'; import { md5 } from '../../system/string';
import { runGitCommandInTerminal } from '../../terminal'; import { runGitCommandInTerminal } from '../../terminal';
import type { GitProviderDescriptor, GitRepositoryCaches } from '../gitProvider';
import type { GitDir, GitProviderDescriptor, GitRepositoryCaches } from '../gitProvider';
import type { RemoteProviders } from '../remotes/remoteProviders'; import type { RemoteProviders } from '../remotes/remoteProviders';
import { loadRemoteProviders } from '../remotes/remoteProviders'; import { loadRemoteProviders } from '../remotes/remoteProviders';
import type { RichRemoteProvider } from '../remotes/richRemoteProvider'; import type { RichRemoteProvider } from '../remotes/richRemoteProvider';
@ -289,7 +289,7 @@ export class Repository implements Disposable {
return watcher; return watcher;
} }
const gitDir = await this.container.git.getGitDir(this.path);
const gitDir = await this.getGitDir();
if (gitDir != null) { if (gitDir != null) {
if (gitDir?.commonUri == null) { if (gitDir?.commonUri == null) {
watch.call( watch.call(
@ -596,6 +596,14 @@ export class Repository implements Disposable {
return this.container.git.getContributors(this.path, options); return this.container.git.getContributors(this.path, options);
} }
private _gitDir: Promise<GitDir | undefined> | undefined;
private getGitDir(): Promise<GitDir | undefined> {
if (this._gitDir == null) {
this._gitDir = this.container.git.getGitDir(this.path);
}
return this._gitDir;
}
private _lastFetched: number | undefined; private _lastFetched: number | undefined;
@gate() @gate()
async getLastFetched(): Promise<number> { async getLastFetched(): Promise<number> {

Loading…
Cancel
Save