atom-git-control
atom-git-control copied to clipboard
Uncaught TypeError: Cannot read property 'split' of undefined
[Enter steps to reproduce:]
- Right click on js file to open git contol
- tried to open git control
Atom: 1.24.1 x64 Electron: 1.6.16 OS: Microsoft Windows 7 Professional Thrown From: git-control package 0.9.0
Stack Trace
Uncaught TypeError: Cannot read property 'split' of undefined
At C:\Users\Sara\.atom\packages\git-control\lib\git-control-view.coffee:76
TypeError: Cannot read property 'split' of undefined
at GitControlView.module.exports.GitControlView.initialize (/packages/git-control/lib/git-control-view.coffee:76:50)
at /packages/git-plus/node_modules/space-pen/lib/space-pen.js:184:25)
at /packages/git-control/lib/git-control-view.coffee:36:7)
at Object.toggleView (/packages/git-control/lib/git-control.coffee:31:18)
at /packages/git-control/lib/git-control.coffee:18:57)
at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.24.1/resources/app/src/command-registry.js:388:36)
at CommandRegistry.dispatch (~/AppData/Local/atom/app-1.24.1/resources/app/src/command-registry.js:273:23)
at AtomEnvironment.dispatchContextMenuCommand (~/AppData/Local/atom/app-1.24.1/resources/app/src/atom-environment.js:1290:25)
at EventEmitter.outerCallback (~/AppData/Local/atom/app-1.24.1/resources/app/src/application-delegate.js:346:31)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
Commands
-0:56.4.0 git-control:toggle (span.syntax--markup.syntax--underline.syntax--link.syntax--http.syntax--hyperlink)
Non-Core Packages
angularjs 0.5.3
atom-beautify 0.32.2
auto-detect-indentation 1.3.0
busy-signal 1.4.3
git-control 0.9.0
git-plus 7.10.2
goto-definition 1.3.4
hyperclick 0.1.5
intentions 1.1.5
ionic-preview 0.7.0
js-hyperclick 1.13.0
linter 2.2.0
linter-jshint 3.1.6
linter-ui-default 1.7.1
minimap-plus 4.29.2
open-terminal-here 2.3.1
platformio-ide-terminal 2.8.0
standard-formatter 2.8.0
teletype 0.10.0
same error here.
me too
mark for me
same here
Identical error thrown here on Mac High Sierra
This error shows up unless I open a file fresh without any other files opened,
me too
Same on Ubuntu 16.04. Atom 1.25.1 x64 git-control 0.9.0
same here
I have thought my code has bugs before see this issue
I solved my problem creating one condition for verify the property path
is exist
Changing line 76 to:
if git.getRepository().path
@setWorkspaceTitle(git.getRepository().path.split('/').reverse()[1])
else
@setWorkspaceTitle(git.getRepository().repo.workingDirectory.split('/').reverse()[0])
I can confirm that above fix by @wellmotta works for me on:
- Linux pop-os 4.13.0-38-generic
- Atom 1.25.1 x64
same here
[Enter steps to reproduce:]
- ...
- ...
Atom: 1.24.1 x64 Electron: 1.6.16 OS: Debian GNU/Linux Thrown From: git-control package 0.9.0
Stack Trace
Uncaught TypeError: Cannot read property 'split' of undefined
At /home/bellafronte/.atom/packages/git-control/lib/git-control-view.coffee:76
TypeError: Cannot read property 'split' of undefined
at GitControlView.module.exports.GitControlView.initialize (/packages/git-control/lib/git-control-view.coffee:76:50)
at /packages/git-control/node_modules/space-pen/lib/space-pen.js:184:25)
at /packages/git-control/lib/git-control-view.coffee:36:7)
at Object.toggleView (/packages/git-control/lib/git-control.coffee:31:14)
at /packages/git-control/lib/git-control.coffee:18:57)
at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:388:36)
at CommandRegistry.dispatch (/usr/share/atom/resources/app/src/command-registry.js:273:23)
at AtomEnvironment.dispatchApplicationMenuCommand (/usr/share/atom/resources/app/src/atom-environment.js:1286:25)
at EventEmitter.outerCallback (/usr/share/atom/resources/app/src/application-delegate.js:333:31)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)
Commands
-0:51.8.0 core:confirm (input.hidden-input)
-0:15.9.0 git-control:toggle (input.hidden-input)
Non-Core Packages
atom-beautify 0.32.2
atom-bootstrap3 1.2.12
busy-signal 1.4.3
comment 0.6.1
delete-lines 0.5.0
emmet 2.4.3
file-icons 2.1.18
git-control 0.9.0
git-gui 0.1.27
git-plus 7.10.2
gulp-control 0.5.0
highlight-selected 0.13.1
intentions 1.1.5
language-smarty 1.8.0
linter 2.2.0
linter-spell 0.15.0
linter-spell-javascript 0.9.0
linter-ui-default 1.7.1
markdown-img-paste 0.3.9
markdown-pdf 2.1.0
markdown-table-editor 1.1.0
markdown-writer 2.7.3
minimap 4.29.8
minimap-highlight-selected 4.6.1
pigments 0.40.2
uglify 1.3.1
@wellmotta's fix works for me as well -- please note you have to exit Atom and relaunch for the changes to take effect. Disabling and enabling the package isn't enough.
@wellmotta's fix is also works for me on:
MacOS 10.13 Atom 1.26.0 x64
@MarcelMue @jacogr will @wellmotta's fix be implemented in the near-future?
@wellmotta's fix also worked for me as well.
MacOS 10.13.4 Atom 1.27.1 x64
@wellmotta's fix is also works for me on:
MacOS 10.13 Atom 1.28.0 x64
@wellmotta’s fix WFM on
Ubuntu 18.04 LTS Atom 1.28.0. x64
@seanidzenga ISTM that @wellmotta should issue a pull request.
@wellmotta's fix works for me as well. thank you.
Windows 10 1803 Atom 1.28.3 x64
it doesn't matter
I'm also having this problem but I got @wellmotta's fix to work. With so many people having this problem and such a simple fix, why hasn't it been fixed?
I'm having the same problem, also not sure why but I sometimes get keychain wanting my password but I ignore it. Can someone explain how I can get @wellmotta 's fix to work? I see lines of code but don't know where to put them. Thanks.
@lacostenycoder go to ~/.atom/packages/git-control/lib and open git-control-view.coffee. Scroll down to line 76, remove what's already there, and paste this:
if git.getRepository().path @setWorkspaceTitle(git.getRepository().path.split('/').reverse()[1]) else @setWorkspaceTitle(git.getRepository().repo.workingDirectory.split('/').reverse()[0])
Make sure the indenting is the same as everywhere else, otherwise you'll get an error. But once done, hit save, close Atom, then re-open it and you should be good. The code should end up looking like this:
@QuentinMcCarthy Thanks a lot! I see a bunch of PRs open for what look like similar solutions https://github.com/jacogr/atom-git-control/pulls
@jacogr, @MarcelMue is this repo still being maintained? Can we help?
+1 @wellmotta's fix
Not that it makes a world of difference but personally, I consider runtime monkey patching safer than 3rd party source code modification so I have this guy in my init.coffee ->
atom.commands.onWillDispatch ({ type }) ->
switch type
{ ... } # other commands
when 'git-control:toggle'
git = atom.project.getRepositories()[0]
Object.defineProperty(git, 'path', {
get: -> git.repo.workingDirectory
}
@wellmotta's fix is also works for me on:
Ubuntu 14 Atom 1.26.1
Thank you
@whapky
Not that it makes a world of difference but personally, I consider runtime monkey patching safer than 3rd party source code modification so I have this guy in my init.coffee ->
Good point. However, until and unless this repo gets resurrected... but if it does, the 3rd party manipulation would get lost, right?
Likely. The problem I had in mind is that you may end up relying (aka building) on incompatible local changes making it very difficult to upgrade to a newer version. Not a common scenario for a top level editor package so I'm probably doomsaying though ;)
Surprised believe this hasn't been patched yet. Wonder if @MarcelMue and @jacogr would mind adding another active maintainer
Still exist
I actually think this repository might be dead. The last push was in May 2017. Either they're slow developers working locally only, or they're simply not maintaining this anymore.
@lacostenycoder go to ~/.atom/packages/git-control/lib and open git-control-view.coffee. Scroll down to line 76, remove what's already there, and paste this:
if git.getRepository().path @setWorkspaceTitle(git.getRepository().path.split('/').reverse()[1]) else @setWorkspaceTitle(git.getRepository().repo.workingDirectory.split('/').reverse()[0])
i get unexpected if in file:///C:/Users/xxxxx/.atom/packages/git-control/lib/git-control-view.coffee:76:6
Try pasting it exactly as written -- whitespace and all.
solution @wellmotta 's work