gitHistoryVSCode icon indicating copy to clipboard operation
gitHistoryVSCode copied to clipboard

"ERR Cannot read property 'toString' of undefined"

Open JonGarbayo opened this issue 8 years ago • 3 comments

Hi!

  • VSCode Version: 1.25.0
  • OS Version: Ubuntu 16.04

With new stable VS Code (1.25), a new issue happens every time I click to "Compare against previous version": it does nothing. Same with the other items of this menu ("View file contents", etc.).

In the developer tools, I got these errors:

console.ts:136 [Extension Host] rejected promise not handled within 1 second
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:393
(anonymous) @ extensionHost.ts:210
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104

log.ts:171   ERR Cannot read property 'toString' of undefined : TypeError: Cannot read property 'toString' of undefined
    at Git.<anonymous> (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:348:75)
    at Generator.next (<anonymous>)
    at fulfilled (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:16:58)
    at <anonymous>
log.ts:171   ERR Path must be a string. Received undefined : TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.relative (path.js:1227:5)
    at Git.<anonymous> (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:400:43)
    at Generator.next (<anonymous>)
    at fulfilled (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:16:58)
    at <anonymous>
log.ts:171   ERR Cannot read property 'toString' of undefined : TypeError: Cannot read property 'toString' of undefined
    at Git.<anonymous> (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:348:75)
    at Generator.next (<anonymous>)
    at fulfilled (/home/jgarbayo/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js:16:58)
    at <anonymous>

These are from the "Compare against previous version" item. You will have different ones with the others.

If you need more info, please tell me :)

Have a nice day!

JonGarbayo avatar Jul 06 '18 09:07 JonGarbayo

Hi,

same problem here. I found a quick way to bring back the functionality, by editing the src files. I haven't had a closer look, but the file object is missing the fsPath Key. So I cleaned up the path key and set fsPath to path. But be aware, that's just horrible way and obviously not the right way and I have no idea if this will affect the extension in other parts - I just looked at the "compare with previous version"-part.

So as a (not recommended) temp "fix" add 2 lines of code in $USERDIR/.vscode/extensions/donjayamanne.githistory-0.4.1/out/src/adapter/repository/git.js

In getCommitFile(hash, file) before const filePath = typeof file === 'string' ? file : file.fsPath.toString();

I added: while(file.path.charAt(0) === '/') { file.path = file.path.substr(1); } file.fsPath = file.path;

Thats extremly ugly und not a real fix, but it brought me back the ability to compare with the previous version. Other problems since the last vc code update are still in there.

skep avatar Jul 13 '18 09:07 skep

Interesting. I can't seem to get my hands on a copy of 1.24.x It would be interesting to see what's getting passed into that function in 1.24 vs what's being passed in in 1.25.x.

RevFry avatar Jul 13 '18 14:07 RevFry

Duplicate of #293, new version will be released soon

DonJayamanne avatar Jul 17 '18 16:07 DonJayamanne