Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Uncaught TypeError: Cannot read property 'split' of undefined #259

Open
junakmlakonja opened this issue Mar 15, 2018 · 37 comments
Open

Uncaught TypeError: Cannot read property 'split' of undefined #259

junakmlakonja opened this issue Mar 15, 2018 · 37 comments

Comments

@junakmlakonja
Copy link

[Enter steps to reproduce:]

  1. Right click on js file to open git contol
  2. 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 
@Lieneke
Copy link

Lieneke commented Mar 26, 2018

same error here.

@joe-higgins
Copy link

me too

@lfire
Copy link

lfire commented Mar 28, 2018

mark for me

@Majestic3691
Copy link

same here

@emrys57
Copy link

emrys57 commented Apr 3, 2018

Identical error thrown here on Mac High Sierra

@ugge77
Copy link

ugge77 commented Apr 3, 2018

This error shows up unless I open a file fresh without any other files opened,

@WakuwakuP
Copy link

me too

@igorpupkinable
Copy link

Same on Ubuntu 16.04.
Atom 1.25.1 x64
git-control 0.9.0

@pigpigever
Copy link

I have thought my code has bugs before see this issue

@wellmotta
Copy link

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])

git.getRepository()

wellmotta added a commit to wellmotta/atom-git-control that referenced this issue Apr 11, 2018
@ghost
Copy link

ghost commented Apr 11, 2018

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

@andrekutianski
Copy link

same here

[Enter steps to reproduce:]

  1. ...
  2. ...

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 

@garrettw
Copy link

@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.

@jwzhai
Copy link

jwzhai commented Apr 27, 2018

@wellmotta's fix is also works for me on:

MacOS 10.13
Atom 1.26.0 x64

@seanidzenga
Copy link

@MarcelMue @jacogr will @wellmotta's fix be implemented in the near-future?

@FoxGroveMedia
Copy link

@wellmotta's fix also worked for me as well.

MacOS 10.13.4
Atom 1.27.1 x64

@Chinalink
Copy link

@wellmotta's fix is also works for me on:

MacOS 10.13
Atom 1.28.0 x64

@PointedEars
Copy link

PointedEars commented Jun 28, 2018

@wellmotta’s fix WFM on

Ubuntu 18.04 LTS
Atom 1.28.0. x64

@seanidzenga ISTM that @wellmotta should issue a pull request.

@nikinicky
Copy link

@wellmotta's fix works for me as well. thank you.

@Oliver-GMJ
Copy link

Windows 10 1803
Atom 1.28.3 x64

@stormmao
Copy link

it doesn't matter

@QuentinMcCarthy
Copy link

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?

@lacostenycoder
Copy link

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.

@QuentinMcCarthy
Copy link

QuentinMcCarthy commented Aug 29, 2018

@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:
image

@lacostenycoder
Copy link

lacostenycoder commented Aug 29, 2018

@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?

@selbyk
Copy link

selbyk commented Sep 5, 2018

+1 @wellmotta's fix

@tanfonto
Copy link

tanfonto commented Oct 14, 2018

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
      }

@wzbooks
Copy link

wzbooks commented Oct 26, 2018

@wellmotta's fix is also works for me on:

Ubuntu 14
Atom 1.26.1

Thank you

@lacostenycoder
Copy link

lacostenycoder commented Oct 26, 2018

@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?

@tanfonto
Copy link

tanfonto commented Oct 26, 2018

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 ;)

@selbyk
Copy link

selbyk commented Nov 14, 2018

Surprised believe this hasn't been patched yet. Wonder if @MarcelMue and @jacogr would mind adding another active maintainer

@itsanjan
Copy link

Still exist

@QuentinMcCarthy
Copy link

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.

@miztizm
Copy link

miztizm commented Jan 18, 2019

@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

@garrettw
Copy link

Try pasting it exactly as written -- whitespace and all.

@DrewYa
Copy link

DrewYa commented Mar 15, 2019

solution @wellmotta 's work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests