Skip to content

Commit 787a2a5

Browse files
Copilotalexr00
andcommitted
Fix: Handle comments on commits that no longer exist gracefully
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent d72e3e6 commit 787a2a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/view/gitContentProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class GitContentFileSystemProvider extends RepositoryFileSystemProvider {
5858
return new TextEncoder().encode('');
5959
}
6060

61-
const { path, commit, rootPath } = fromReviewUri(uri.query);
61+
const { path, commit, rootPath, isOutdated } = fromReviewUri(uri.query);
6262

6363
if (!path || !commit) {
6464
return new TextEncoder().encode('');
@@ -94,7 +94,7 @@ export class GitContentFileSystemProvider extends RepositoryFileSystemProvider {
9494
} catch (err) {
9595
Logger.error(err, GitContentFileSystemProvider.ID);
9696
// Only show the error if we know it's not an outdated commit
97-
if (!this.getOutdatedChangeModelForFile(uri)) {
97+
if (!isOutdated && !this.getOutdatedChangeModelForFile(uri)) {
9898
vscode.window.showErrorMessage(
9999
`We couldn't find commit ${commit} locally. You may want to sync the branch with remote. Sometimes commits can disappear after a force-push`,
100100
);

0 commit comments

Comments
 (0)