mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 14:01:38 +01:00
Git - handle local tracking branches (#238503)
This commit is contained in:
@@ -2451,7 +2451,9 @@ export class Repository {
|
||||
|
||||
// Upstream commit
|
||||
if (HEAD && HEAD.upstream) {
|
||||
const ref = `refs/remotes/${HEAD.upstream.remote}/${HEAD.upstream.name}`;
|
||||
const ref = HEAD.upstream.remote !== '.'
|
||||
? `refs/remotes/${HEAD.upstream.remote}/${HEAD.upstream.name}`
|
||||
: `refs/heads/${HEAD.upstream.name}`;
|
||||
const commit = await this.revParse(ref);
|
||||
HEAD = { ...HEAD, upstream: { ...HEAD.upstream, commit } };
|
||||
}
|
||||
|
||||
@@ -136,12 +136,27 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
||||
historyItemRefName = this.repository.HEAD.name;
|
||||
|
||||
// Remote
|
||||
this._currentHistoryItemRemoteRef = this.repository.HEAD.upstream ? {
|
||||
id: `refs/remotes/${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
|
||||
name: `${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
|
||||
revision: this.repository.HEAD.upstream.commit,
|
||||
icon: new ThemeIcon('cloud')
|
||||
} : undefined;
|
||||
if (this.repository.HEAD.upstream) {
|
||||
if (this.repository.HEAD.upstream.remote === '.') {
|
||||
// Local branch
|
||||
this._currentHistoryItemRemoteRef = {
|
||||
id: `refs/heads/${this.repository.HEAD.upstream.name}`,
|
||||
name: this.repository.HEAD.upstream.name,
|
||||
revision: this.repository.HEAD.upstream.commit,
|
||||
icon: new ThemeIcon('gi-branch')
|
||||
};
|
||||
} else {
|
||||
// Remote branch
|
||||
this._currentHistoryItemRemoteRef = {
|
||||
id: `refs/remotes/${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
|
||||
name: `${this.repository.HEAD.upstream.remote}/${this.repository.HEAD.upstream.name}`,
|
||||
revision: this.repository.HEAD.upstream.commit,
|
||||
icon: new ThemeIcon('cloud')
|
||||
};
|
||||
}
|
||||
} else {
|
||||
this._currentHistoryItemRemoteRef = undefined;
|
||||
}
|
||||
|
||||
// Base
|
||||
if (this._HEAD?.name !== this.repository.HEAD.name) {
|
||||
|
||||
Reference in New Issue
Block a user