Преглед на файлове

Fixes more detached head state issues

main
Eric Amodio преди 6 години
родител
ревизия
dd82de02f0
променени са 4 файла, в които са добавени 14 реда и са изтрити 7 реда
  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 Целия файл

@ -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 Целия файл

@ -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 Целия файл

@ -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 Целия файл

@ -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 [];

Зареждане…
Отказ
Запис