vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

Hackfixes #2061

Open capaj opened this issue 3 years ago • 3 comments

not sure if it is going to return the correct path this way, but at least it would remove the annoying error notification in VSCode spamming 25x a minute, reported here: https://github.com/gitkraken/vscode-gitlens/issues/2061

❤ Thank you for contributing to GitLens! ❤

🚨 IMPORTANT 🚨

  • Please create an issue before creating a Pull Request
  • Please use the following Git commit message style
    • Use the future tense ("Adds feature" not "Added feature")
    • Use a "Fixes #xxx -" or "Closes #xxx -" prefix to auto-close the issue that your PR addresses
    • Limit the first line to 72 characters or less
    • Reference issues and pull requests liberally after the first line

↑👆 DELETE above before submitting 👆↑


Description

Checklist

  • [ ] I have followed the guidelines in the Contributing document
  • [ ] My changes follow the coding style of this project
  • [ ] My changes build without any errors or warnings
  • [ ] My changes have been formatted and linted
  • [ ] My changes include any required corresponding changes to the documentation
  • [ ] My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • [ ] My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

capaj avatar Jul 05 '22 11:07 capaj

@capaj Since you are able to reproduce this (I still can't), can you please provide the call stack for when your new code applies? I'm assuming that somehow a null or undefined is coming through as the pathOrUri parameter, but not sure from where. Thanks!

eamodio avatar Jul 11 '22 17:07 eamodio

This is the callstack I get in my vscode

TypeError: Cannot read properties of undefined (reading 'fsPath')
    at Ke.getRelativePath (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/env/node/git/localGitProvider.ts:742:56)
    at Ke.getAbsoluteUri (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/env/node/git/localGitProvider.ts:684:29)
    at Object.getAbsoluteUri (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/git/gitProviderService.ts:887:19)
    at Function.fromFile (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/git/gitUri.ts:229:15)
    at new FileRevisionAsCommitNode (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/views/nodes/fileRevisionAsCommitNode.ts:37:9)
    at vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/views/nodes/lineHistoryNode.ts:142:10
    at filterMap (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/system/iterable.ts:90:18)
    at m.next (<anonymous>)
    at insertDateMarkers (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/views/nodes/helpers.ts:28:13)
    at Er.next (<anonymous>)
    at E.getChildren (vscode-file://vscode-app/home/capaj/.vscode/extensions/eamodio.gitlens-12.1.1/dist/webpack:/gitlens/src/views/nodes/lineHistoryNode.ts:138:13)
    at v.fetchChildrenNodes (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:19736)
    at v.getChildren (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:106:15955)
onDidChangeNotification @ notificationsAlerts.ts:40

image

capaj avatar Jul 12 '22 11:07 capaj

@capaj Thanks, but even from that callstack, I can't understand how we are getting a null/undefined (or something). Is this a public repo that I can test with?

If not, can you put a breakpoint here -- when it happens, what is the value of pathOrUri? https://github.com/gitkraken/vscode-gitlens/blob/0668039c4fa6ff2ce53ff7bcfa505120f91d82cb/src/env/node/git/localGitProvider.ts#L733

It would also be great to know more details about the commit (or commits) that are causing this, maybe another BP here: https://github.com/gitkraken/vscode-gitlens/blob/e916ecb0d14bed5baa9092d37c1a8569b6a1d276/src/views/nodes/fileRevisionAsCommitNode.ts#L37

I can certainly trap for this, but since this case shouldn't be happening, something earlier is going wrong and could be causing other issues, so I really want to get to the bottom of it.

Thanks!

eamodio avatar Jul 15 '22 19:07 eamodio

Closing this as the underlying issue has been fixed.

eamodio avatar Aug 15 '22 07:08 eamodio