Git - handle local tracking branches (#238503)

This commit is contained in:
Ladislau Szomoru
2025-01-22 21:51:31 +01:00
committed by GitHub
parent 485f68f364
commit 42e96916ac
2 changed files with 24 additions and 7 deletions

View File

@@ -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) {