ソースを参照

Fixes #2167 rollup diff not working for behind

main
Eric Amodio 2年前
コミット
d7fcfb4c23
3個のファイルの変更14行の追加3行の削除
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      src/views/nodes/branchTrackingStatusFilesNode.ts
  3. +12
    -3
      src/views/nodes/statusFileNode.ts

+ 1
- 0
CHANGELOG.md ファイルの表示

@ -51,6 +51,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed ### Fixed
- Fixes [#2167](https://github.com/gitkraken/vscode-gitlens/issues/2167) - Rollup diff between working tree and fetched remote doesn't show changes
- Fixes [#2166](https://github.com/gitkraken/vscode-gitlens/issues/2166) - Don't always prompt for GitHub authentication on virtual repositories - Fixes [#2166](https://github.com/gitkraken/vscode-gitlens/issues/2166) - Don't always prompt for GitHub authentication on virtual repositories
- Fixes [#2156](https://github.com/gitkraken/vscode-gitlens/issues/2156) - Reduce extension package size - Fixes [#2156](https://github.com/gitkraken/vscode-gitlens/issues/2156) - Reduce extension package size
- Fixes [#2136](https://github.com/gitkraken/vscode-gitlens/issues/2136) - Search & Compare quickpick shouldn't select the mode text when opening - Fixes [#2136](https://github.com/gitkraken/vscode-gitlens/issues/2136) - Search & Compare quickpick shouldn't select the mode text when opening

+ 1
- 0
src/views/nodes/branchTrackingStatusFilesNode.ts ファイルの表示

@ -89,6 +89,7 @@ export class BranchTrackingStatusFilesNode extends ViewNode {
this.repoPath, this.repoPath,
files[files.length - 1], files[files.length - 1],
files.map(s => s.commit), files.map(s => s.commit),
this.direction,
), ),
); );

+ 12
- 3
src/views/nodes/statusFileNode.ts ファイルの表示

@ -19,10 +19,18 @@ export class StatusFileNode extends ViewNode implements FileNo
public readonly file: GitFile; public readonly file: GitFile;
public readonly repoPath: string; public readonly repoPath: string;
private readonly _direction: 'ahead' | 'behind';
private readonly _hasStagedChanges: boolean; private readonly _hasStagedChanges: boolean;
private readonly _hasUnstagedChanges: boolean; private readonly _hasUnstagedChanges: boolean;
constructor(view: ViewsWithCommits, parent: ViewNode, repoPath: string, file: GitFile, commits: GitCommit[]) {
constructor(
view: ViewsWithCommits,
parent: ViewNode,
repoPath: string,
file: GitFile,
commits: GitCommit[],
direction: 'ahead' | 'behind' = 'ahead',
) {
let hasStagedChanges = false; let hasStagedChanges = false;
let hasUnstagedChanges = false; let hasUnstagedChanges = false;
let ref = undefined; let ref = undefined;
@ -53,6 +61,7 @@ export class StatusFileNode extends ViewNode implements FileNo
this.file = file; this.file = file;
this.commits = commits; this.commits = commits;
this._direction = direction;
this._hasStagedChanges = hasStagedChanges; this._hasStagedChanges = hasStagedChanges;
this._hasUnstagedChanges = hasUnstagedChanges; this._hasUnstagedChanges = hasUnstagedChanges;
} }
@ -244,11 +253,11 @@ export class StatusFileNode extends ViewNode implements FileNo
}; };
} }
const commit = this.commits[this.commits.length - 1];
const commit = this._direction === 'behind' ? this.commits[0] : this.commits[this.commits.length - 1];
const file = commit.files?.find(f => f.path === this.file.path) ?? this.file; const file = commit.files?.find(f => f.path === this.file.path) ?? this.file;
const commandArgs: DiffWithCommandArgs = { const commandArgs: DiffWithCommandArgs = {
lhs: { lhs: {
sha: `${commit.sha}^`,
sha: this._direction === 'behind' ? commit.sha : `${commit.sha}^`,
uri: GitUri.fromFile(file, this.repoPath, undefined, true), uri: GitUri.fromFile(file, this.repoPath, undefined, true),
}, },
rhs: { rhs: {

読み込み中…
キャンセル
保存