Kaynağa Gözat

Fixes more detached head state issues

main
Eric Amodio 6 yıl önce
ebeveyn
işleme
dd82de02f0
4 değiştirilmiş dosya ile 14 ekleme ve 7 silme
  1. +8
    -1
      src/git/models/status.ts
  2. +3
    -3
      src/quickpicks/repoStatusQuickPick.ts
  3. +1
    -1
      src/views/nodes/statusNode.ts
  4. +2
    -2
      src/views/nodes/statusUpstreamNode.ts

+ 8
- 1
src/git/models/status.ts Dosyayı Görüntüle

@ -13,6 +13,8 @@ export interface GitStatusUpstreamState {
}
export class GitStatus {
readonly detached: boolean;
constructor(
public readonly repoPath: string,
public readonly branch: string,
@ -21,11 +23,16 @@ export class GitStatus {
public readonly state: GitStatusUpstreamState,
public readonly upstream?: string
) {
if (GitBranch.isDetached(branch)) {
this.detached = GitBranch.isDetached(branch);
if (this.detached) {
this.branch = GitBranch.formatDetached(this.sha);
}
}
get ref() {
return this.detached ? this.sha : this.branch;
}
private _diff?: {
added: number;
deleted: number;

+ 3
- 3
src/quickpicks/repoStatusQuickPick.ts Dosyayı Görüntüle

@ -391,9 +391,9 @@ export class RepoStatusQuickPick {
},
Commands.ShowQuickBranchHistory,
[
GitUri.fromRepoPath(status.repoPath, `${status.upstream}..${status.branch}`),
GitUri.fromRepoPath(status.repoPath, `${status.upstream}..${status.ref}`),
{
branch: status.branch,
branch: status.ref,
maxCount: 0,
goBackCommand: currentCommand
} as ShowQuickBranchHistoryCommandArgs
@ -421,7 +421,7 @@ export class RepoStatusQuickPick {
},
Commands.ShowQuickBranchHistory,
[
GitUri.fromRepoPath(status.repoPath, `${status.branch}..${status.upstream}`),
GitUri.fromRepoPath(status.repoPath, `${status.ref}..${status.upstream}`),
{
branch: status.upstream,
maxCount: 0,

+ 1
- 1
src/views/nodes/statusNode.ts Dosyayı Görüntüle

@ -38,7 +38,7 @@ export class StatusNode extends ExplorerNode {
}
if (status.state.ahead || (status.files.length !== 0 && this.includeWorkingTree)) {
const range = status.upstream ? `${status.upstream}..${status.branch}` : undefined;
const range = status.upstream ? `${status.upstream}..${status.ref}` : undefined;
children.push(new StatusFilesNode(status, range, this.explorer, this.active));
}
}

+ 2
- 2
src/views/nodes/statusUpstreamNode.ts Dosyayı Görüntüle

@ -25,8 +25,8 @@ export class StatusUpstreamNode extends ExplorerNode {
async getChildren(): Promise<ExplorerNode[]> {
const range =
this.direction === 'ahead'
? `${this.status.upstream}..${this.status.branch}`
: `${this.status.branch}..${this.status.upstream}`;
? `${this.status.upstream}..${this.status.ref}`
: `${this.status.ref}..${this.status.upstream}`;
let log = await Container.git.getLog(this.uri.repoPath!, { maxCount: 0, ref: range });
if (log === undefined) return [];

Yükleniyor…
İptal
Kaydet