mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
SCM - add caching layer to incoming/outgoing tree nodes (#198306)
* Upstream commit + improve onDidChangeCurrentHistoryItemGroup * Refactor expanding a history item group * Wire up caching * Invoking the git.refresh command invalidates the cache * Clean up cache data structure
This commit is contained in:
@@ -2193,6 +2193,13 @@ export class Repository {
|
||||
if (HEAD.name) {
|
||||
// Branch
|
||||
HEAD = await this.getBranch(HEAD.name);
|
||||
|
||||
// Upstream commit
|
||||
if (HEAD && HEAD.upstream) {
|
||||
const ref = `refs/remotes/${HEAD.upstream.remote}/${HEAD.upstream.name}`;
|
||||
const commit = await this.revParse(ref);
|
||||
HEAD = { ...HEAD, upstream: { ...HEAD.upstream, commit } };
|
||||
}
|
||||
} else if (HEAD.commit) {
|
||||
// Tag || Commit
|
||||
const tags = await this.getRefs({ pattern: 'refs/tags' });
|
||||
@@ -2596,6 +2603,13 @@ export class Repository {
|
||||
}
|
||||
|
||||
async revParse(ref: string): Promise<string | undefined> {
|
||||
try {
|
||||
const result = await fs.readFile(path.join(this.dotGit.path, ref), 'utf8');
|
||||
return result.trim();
|
||||
} catch (err) {
|
||||
this.logger.warn(err.message);
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await this.exec(['rev-parse', ref]);
|
||||
if (result.stderr) {
|
||||
|
||||
Reference in New Issue
Block a user