From 54b7daa47a07fdcf29bc8bb858efc1322c6bb1e5 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 21 Nov 2023 17:42:30 -0500 Subject: [PATCH] Fixes load more in file history with renames --- src/env/node/git/localGitProvider.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index c5ac08e..15aaea8 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -3785,7 +3785,7 @@ export class LocalGitProvider implements GitProvider, Disposable { ): Promise { const paths = await this.isTrackedWithDetails(path, repoPath, ref); if (paths == null) { - Logger.log(scope, `Skipping blame; '${path}' is not tracked`); + Logger.log(scope, `Skipping log; '${path}' is not tracked`); return emptyPromise as Promise; } @@ -3868,7 +3868,18 @@ export class LocalGitProvider implements GitProvider, Disposable { moreLimit = moreLimit ?? configuration.get('advanced.maxSearchItems') ?? 0; - const ref = last(log.commits.values())?.ref; + const commit = last(log.commits.values()); + let ref; + if (commit != null) { + ref = commit.ref; + // Check to make sure the filename hasn't changed and if it has use the previous + if (commit.file != null) { + const path = commit.file.originalPath ?? commit.file.path; + if (path !== relativePath) { + relativePath = path; + } + } + } const moreLog = await this.getLogForFile(log.repoPath, relativePath, { ...options, limit: moreUntil == null ? moreLimit : 0,