Bladeren bron

Fixes ahead/behind with working tree

main
Eric Amodio 4 jaren geleden
bovenliggende
commit
2448e7d6ef
1 gewijzigde bestanden met toevoegingen van 8 en 26 verwijderingen
  1. +8
    -26
      src/views/nodes/compareBranchNode.ts

+ 8
- 26
src/views/nodes/compareBranchNode.ts Bestand weergeven

@ -223,30 +223,15 @@ export class CompareBranchNode extends ViewNode
}
private async getAheadFilesQuery(): Promise<FilesQueryResults> {
let files = await Container.git.getDiffStatus(
const files = await Container.git.getDiffStatus(
this.uri.repoPath!,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
GitRevision.createRange(this._compareWith?.ref || 'HEAD', this.branch.ref, '...'),
this.compareWithWorkingTree
? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
this._compareWith?.ref || 'HEAD'
: // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
GitRevision.createRange(this._compareWith?.ref || 'HEAD', this.branch.ref, '...'),
);
if (this.compareWithWorkingTree) {
const workingFiles = await Container.git.getDiffStatus(this.uri.repoPath!, 'HEAD');
if (workingFiles != null) {
if (files != null) {
for (const wf of workingFiles) {
const index = files.findIndex(f => f.fileName === wf.fileName);
if (index !== -1) {
files.splice(index, 1, wf);
} else {
files.push(wf);
}
}
} else {
files = workingFiles;
}
}
}
return {
label: `${Strings.pluralize('file', files?.length ?? 0, { zero: 'No' })} changed`,
files: files,
@ -256,11 +241,8 @@ export class CompareBranchNode extends ViewNode
private async getBehindFilesQuery(): Promise<FilesQueryResults> {
const files = await Container.git.getDiffStatus(
this.uri.repoPath!,
this.compareWithWorkingTree
? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
this._compareWith?.ref || 'HEAD'
: // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
GitRevision.createRange(this.branch.ref, this._compareWith?.ref || 'HEAD', '...'),
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
GitRevision.createRange(this.branch.ref, this._compareWith?.ref || 'HEAD', '...'),
);
return {

Laden…
Annuleren
Opslaan