Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show error "We couldn't find commit" on outdated comments #1691

Closed
ggcatu opened this issue Apr 24, 2020 · 10 comments · Fixed by #6209
Closed

Don't show error "We couldn't find commit" on outdated comments #1691

ggcatu opened this issue Apr 24, 2020 · 10 comments · Fixed by #6209
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded

Comments

@ggcatu
Copy link

ggcatu commented Apr 24, 2020

Issue Type: Bug

Constantly getting this error, is really annoying and breaks the complete usage of the extension.

image

image

Extension version: 0.15.0
VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T16:36:23.138Z)
OS version: Windows_NT x64 10.0.18363

@ThomasGHenry
Copy link

ThomasGHenry commented May 19, 2020

Same. I think it's related to having multiple projects in your workspace, and the wrong one getting loaded. I couldn't even get the thing to load at all until I found this workaround. #1330 (comment)

Roughly, I think the important ingredients to recreate this should be something like:

  1. add additional projects to your vscode workspace (possibly add extension / reload at this point)
  2. create a branch locally
  3. commit/push some work to that branch
  4. apply the above workaround to get the PR panels to show up at all
  5. from the project with the new branch create a PR
  6. browse the files of the PR in the Local Pull Request Branches view of this extension (observe expected behavior)
  7. browse "Files" in "Changes in Pull Request" panel, observe expected behavior
  8. browse "Commits" in that same panel, and observe the error reported by @ggcatu and files either don't load or display diff as if the file were new

Thanks

@alexr00 alexr00 self-assigned this Nov 11, 2020
@alexr00 alexr00 added the bug Issue identified by VS Code Team member as probable bug label Nov 11, 2020
@alexr00
Copy link
Member

alexr00 commented Dec 12, 2022

I think this has been fixed in the mean time. If you're still seeing it please ping this issue and I will reopen!

@alexr00 alexr00 closed this as completed Dec 12, 2022
@victorlin
Copy link

@alexr00 I am still seeing this quite often. Not as a result of multiple projects, but as a result of force-pushes that remove a commit from the PR branch.

For example, I had nextstrain/ncov@4e5ee67 in a PR branch. I then force-pushed to drop the commit (over a month ago). I just cloned and opened the repo on a new computer and got the message

We couldn't find commit 4e5ee678e3e4f6a8256955c8c1ab99d2fccecd60 ...

@alexr00
Copy link
Member

alexr00 commented Aug 22, 2024

@victorlin did you have the default branch checked out? Was that commit on the default branch?

@victorlin
Copy link

@alexr00 It happened on a fresh clone of the repo with the default branch checked out. The commit was never on the default branch.

@alexr00
Copy link
Member

alexr00 commented Aug 22, 2024

Is there an open PR that contains the commit somehow? Can you share your value of the setting githubPullRequests.queries?

@victorlin
Copy link

It's not on any open PR/branch. I think if that were the case, it would show up on the commit page nextstrain/ncov@4e5ee67

My setting is "githubPullRequests.queries": [] (I've removed the default queries).

@victorlin
Copy link

@alexr00 I just observed this again in another repo (nextstrain/nextstrain.org):

We couldn't find commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 locally. You may want to sync the branch with remote. Sometimes commits can disappear after a force-push

Commit is available in the remote as nextstrain/nextstrain.org@5709c3c but not locally:

$ git log -1 5709c3ce11f60cf66fa4ae3604643018e70e2e00
fatal: bad object 5709c3ce11f60cf66fa4ae3604643018e70e2e00
Here are the extension logs with irrelevant system paths redacted
2024-08-27 16:20:30.378 [info] Activation> Extension version: 0.94.0
2024-08-27 16:20:30.646 [info] Looking for git repository
2024-08-27 16:20:30.646 [info] Found 0 repositories during activation
2024-08-27 16:20:30.646 [info] Git repository found, initializing review manager and pr tree view.
2024-08-27 16:20:30.646 [info] Registering git provider
2024-08-27 16:20:33.169 [info] Activation> Extension version: 0.94.0
2024-08-27 16:20:33.317 [info] Looking for git repository
2024-08-27 16:20:33.317 [info] Found 0 repositories during activation
2024-08-27 16:20:33.317 [info] Git repository found, initializing review manager and pr tree view.
2024-08-27 16:20:33.319 [info] Registering git provider
2024-08-27 16:20:33.319 [info] Review+0> Validate state in progress
2024-08-27 16:20:33.319 [info] Review+0> Validating state...
2024-08-27 16:20:33.331 [info] Found GitHub remote for folder …/nextstrain/nextstrain.org
2024-08-27 16:20:33.636 [info] Trying to use globalState for assignableUsers.
2024-08-27 16:20:33.698 [info] Review+0> Found matching pull request metadata for current branch rss-feed-932. Repo: nextstrain/nextstrain.org PR: 990
2024-08-27 16:20:33.698 [info] Review+0> current branch rss-feed-932 is associated with pull request #990
2024-08-27 16:20:33.698 [info] Review+0> Resolving pull request
2024-08-27 16:20:33.698 [info] FolderRepositoryManager+0> Found GitHub repo for pr #990: yes
2024-08-27 16:20:33.730 [info] Using globalState assignableUsers for 1.
2024-08-27 16:20:34.276 [info] Repo state for file://…/nextstrain/nextstrain.org changed.
2024-08-27 16:20:34.276 [info] Repo file://…/nextstrain/nextstrain.org has already been setup.
2024-08-27 16:20:34.348 [info] FolderRepositoryManager+0> Found GitHub pr repo for pr #990: yes
2024-08-27 16:20:34.348 [info] GitHubRepository+0> Fetch branch master - enter
2024-08-27 16:20:34.525 [info] GitHubRepository+0> Fetch branch master - done: true
2024-08-27 16:20:34.528 [info] Review+0> Resolved PR #990, state is 0
2024-08-27 16:20:34.528 [info] Review+0> Fetching pull request data
2024-08-27 16:20:34.528 [info] PullRequestTree> Adding PR #990 to tree
2024-08-27 16:20:34.733 [info] Review+0> Register comments provider
2024-08-27 16:20:34.733 [info] Review+0> Register in memory content provider
2024-08-27 16:20:35.200 [info] Review+0> Display pull request status bar indicator.
2024-08-27 16:20:35.200 [info] Review+0> Using focus mode = true.
2024-08-27 16:20:35.200 [info] Review+0> State validation silent = true.
2024-08-27 16:20:35.200 [info] Review+0> PR show should show = false.
2024-08-27 16:20:36.193 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 85b014eb490eee0bcdc663e61cc3e00c69fe1a76 and path …/nextstrain/nextstrain.org/static-site/src/util/blogPosts.js
2024-08-27 16:20:36.194 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 85b014eb490eee0bcdc663e61cc3e00c69fe1a76 and path …/nextstrain/nextstrain.org/static-site/src/util/blogPosts.js
2024-08-27 16:20:36.194 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/static-site/src/components/layout.jsx
2024-08-27 16:20:36.196 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/static-site/src/components/layout.jsx
2024-08-27 16:20:36.196 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/static-site/src/util/blogPosts.js
2024-08-27 16:20:36.198 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/static-site/src/util/blogPosts.js
2024-08-27 16:20:36.199 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/package.json
2024-08-27 16:20:36.200 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 5709c3ce11f60cf66fa4ae3604643018e70e2e00 and path …/nextstrain/nextstrain.org/package.json
2024-08-27 16:20:36.201 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 43a922fb76960f818e28cb64a0b0139c27ec81ff and path …/nextstrain/nextstrain.org/static-site/data/SiteConfig.jsx
2024-08-27 16:20:36.201 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 43a922fb76960f818e28cb64a0b0139c27ec81ff and path …/nextstrain/nextstrain.org/static-site/data/SiteConfig.jsx
2024-08-27 16:20:36.201 [info] GitContentFileSystemProvider> Getting change model (file://…/nextstrain/nextstrain.org) content for commit 43a922fb76960f818e28cb64a0b0139c27ec81ff and path …/nextstrain/nextstrain.org/static-site/src/util/blogFeeds.js
2024-08-27 16:20:36.202 [info] GitContentFileSystemProvider> Getting repository (file://…/nextstrain/nextstrain.org) content for commit 43a922fb76960f818e28cb64a0b0139c27ec81ff and path …/nextstrain/nextstrain.org/static-site/src/util/blogFeeds.js
2024-08-27 16:20:36.267 [info] GitContentFileSystemProvider> Using fallback content provider.
2024-08-27 16:20:36.273 [info] GitContentFileSystemProvider> Using fallback content provider.
2024-08-27 16:20:36.278 [info] GitContentFileSystemProvider> Using fallback content provider.
2024-08-27 16:20:36.282 [info] GitContentFileSystemProvider> Using fallback content provider.
2024-08-27 16:20:36.287 [error] Failed to execute git
2024-08-27 16:20:36.295 [error] Failed to execute git
2024-08-27 16:20:36.298 [error] Failed to execute git
2024-08-27 16:20:36.298 [error] Failed to execute git
2024-08-27 16:20:37.011 [info] Review+0> Validate state in progress
2024-08-27 16:20:37.011 [info] Review+0> Validating state...
2024-08-27 16:20:37.071 [info] Found GitHub remote for folder …/nextstrain/nextstrain.org
2024-08-27 16:20:37.072 [info] Trying to use globalState for mentionableUsers.
2024-08-27 16:20:37.072 [info] Using in-memory cached assignable users.
2024-08-27 16:20:37.087 [info] Using globalState mentionableUsers for 1.
2024-08-27 16:20:37.103 [info] Review+0> No matching pull request metadata found locally for current branch master
2024-08-27 16:20:37.652 [info] Review+0> No matching pull request metadata found on GitHub for current branch master
2024-08-27 16:20:37.652 [info] PullRequestTree> Removing PR #990 from tree

Let me know if you need anything else or if I should open a separate issue for better visibility, since this one is still in closed state.

@alexr00 alexr00 reopened this Aug 28, 2024
@alexr00 alexr00 added this to the September 2024 milestone Aug 28, 2024
@victorlin
Copy link

I think I found a way to reproduce:

  1. Make a comment on changes from a certain commit in a PR
  2. Remove/update that commit (e.g. via force push)
  3. Open the comment in the extension
  4. Observe error

Here's a demo:

vscode-github-pr-bug-repro.mov

@alexr00
Copy link
Member

alexr00 commented Sep 3, 2024

I've been able to repro this. The commit really just doesn't exist anymore when this happens. We're not going to be able to show comments that belong to that commit on the correct line, and we're not going to be able to show file contents for that commit. I think the most reasonable thing to do is to just suppress the error if we know it's for an outdated commit.

alexr00 added a commit that referenced this issue Sep 3, 2024
@amunger amunger added the verified Verification succeeded label Sep 26, 2024
@alexr00 alexr00 changed the title We couldn't find commit Don't show error "We couldn't find commit" on outdated comments Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants