Fix timeline git requests are not cancelled when switching editors too fast (#244335)

* Cancel git log commands from timeline

* Don't delete timeline requests when cancelled as they already got deleted

---------

Co-authored-by: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com>
This commit is contained in:
Jean Pierre
2025-05-23 23:15:56 +05:45
committed by GitHub
parent b906eb8438
commit 36ce9d0b7c
4 changed files with 22 additions and 19 deletions

View File

@@ -1342,7 +1342,7 @@ export class Repository {
return parseGitCommits(result.stdout);
}
async logFile(uri: Uri, options?: LogFileOptions): Promise<Commit[]> {
async logFile(uri: Uri, options?: LogFileOptions, cancellationToken?: CancellationToken): Promise<Commit[]> {
const args = ['log', `--format=${COMMIT_FORMAT}`, '-z'];
if (options?.maxEntries && !options?.reverse) {
@@ -1373,7 +1373,7 @@ export class Repository {
args.push('--', uri.fsPath);
try {
const result = await this.exec(args);
const result = await this.exec(args, { cancellationToken });
if (result.exitCode) {
// No file history, e.g. a new file or untracked
return [];