浏览代码

Fixes issue with remote cache normalization

main
Eric Amodio 7 年前
父节点
当前提交
5de0196cee
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. +9
    -3
      src/gitService.ts

+ 9
- 3
src/gitService.ts 查看文件

@ -913,23 +913,29 @@ export class GitService extends Disposable {
}
hasRemotes(repoPath: string): boolean {
const remotes = this._remotesCache.get(repoPath);
const remotes = this._remotesCache.get(this.normalizeRepoPath(repoPath));
return remotes !== undefined && remotes.length > 0;
}
private normalizeRepoPath(repoPath: string) {
return (repoPath.endsWith('/') ? repoPath : `${repoPath}/`).toLowerCase();
}
async getRemotes(repoPath: string): Promise<GitRemote[]> {
if (!repoPath) return [];
Logger.log(`getRemotes('${repoPath}')`);
let remotes = this._remotesCache.get(repoPath);
const normalizedRepoPath = this.normalizeRepoPath(repoPath);
let remotes = this._remotesCache.get(normalizedRepoPath);
if (remotes !== undefined) return remotes;
const data = await Git.remote(repoPath);
remotes = GitRemoteParser.parse(data, repoPath);
if (remotes !== undefined) {
this._remotesCache.set(repoPath, remotes);
this._remotesCache.set(normalizedRepoPath, remotes);
}
return remotes;

正在加载...
取消
保存