Procházet zdrojové kódy

Fixes ahead/behind with working tree

main
Eric Amodio před 4 roky
rodič
revize
2448e7d6ef
1 změnil soubory, kde provedl 8 přidání a 26 odebrání
  1. +8
    -26
      src/views/nodes/compareBranchNode.ts

+ 8
- 26
src/views/nodes/compareBranchNode.ts Zobrazit soubor

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

Načítá se…
Zrušit
Uložit