atom-git-control icon indicating copy to clipboard operation
atom-git-control copied to clipboard

Uncaught TypeError: Cannot read property 'split' of undefined

Open junakmlakonja opened this issue 6 years ago • 37 comments

[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 

junakmlakonja avatar Mar 15 '18 08:03 junakmlakonja

same error here.

Lieneke avatar Mar 26 '18 09:03 Lieneke

me too

joe-higgins avatar Mar 27 '18 20:03 joe-higgins

mark for me

lfire avatar Mar 28 '18 02:03 lfire

same here

Majestic3691 avatar Mar 29 '18 21:03 Majestic3691

Identical error thrown here on Mac High Sierra

emrys57 avatar Apr 03 '18 04:04 emrys57

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

ugge77 avatar Apr 03 '18 10:04 ugge77

me too

WakuwakuP avatar Apr 05 '18 05:04 WakuwakuP

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

igorpupkinable avatar Apr 06 '18 14:04 igorpupkinable

same here

misterpip avatar Apr 06 '18 23:04 misterpip

I have thought my code has bugs before see this issue

pigpigever avatar Apr 07 '18 17:04 pigpigever

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 avatar Apr 11 '18 20:04 wellmotta

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

ghost avatar Apr 11 '18 21:04 ghost

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 

andrekutianski avatar Apr 12 '18 16:04 andrekutianski

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

garrettw avatar Apr 19 '18 14:04 garrettw

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

MacOS 10.13 Atom 1.26.0 x64

jwzhai avatar Apr 27 '18 01:04 jwzhai

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

seanidzenga avatar May 16 '18 13:05 seanidzenga

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

MacOS 10.13.4 Atom 1.27.1 x64

FoxGroveMedia avatar May 29 '18 13:05 FoxGroveMedia

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

MacOS 10.13 Atom 1.28.0 x64

Chinalink avatar Jun 27 '18 02:06 Chinalink

@wellmotta’s fix WFM on

Ubuntu 18.04 LTS Atom 1.28.0. x64

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

PointedEars avatar Jun 28 '18 11:06 PointedEars

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

nikinicky avatar Jul 04 '18 04:07 nikinicky

Windows 10 1803 Atom 1.28.3 x64

Oliver-GMJ avatar Jul 21 '18 07:07 Oliver-GMJ

it doesn't matter

stormmao avatar Aug 19 '18 10:08 stormmao

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?

QuentinMcCarthy avatar Aug 28 '18 23:08 QuentinMcCarthy

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 avatar Aug 29 '18 22:08 lacostenycoder

@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

QuentinMcCarthy avatar Aug 29 '18 22:08 QuentinMcCarthy

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

lacostenycoder avatar Aug 29 '18 22:08 lacostenycoder

+1 @wellmotta's fix

selbyk avatar Sep 05 '18 16:09 selbyk

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
      }

tanfonto avatar Oct 14 '18 16:10 tanfonto

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

Ubuntu 14 Atom 1.26.1

Thank you

wzbooks avatar Oct 26 '18 08:10 wzbooks

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

lacostenycoder avatar Oct 26 '18 14:10 lacostenycoder

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

tanfonto avatar Oct 26 '18 20:10 tanfonto

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

selbyk avatar Nov 14 '18 20:11 selbyk

Still exist

itsanjan avatar Nov 25 '18 01:11 itsanjan

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.

QuentinMcCarthy avatar Nov 25 '18 22:11 QuentinMcCarthy

@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

miztizm avatar Jan 18 '19 14:01 miztizm

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

garrettw avatar Jan 18 '19 14:01 garrettw

solution @wellmotta 's work

DrewYa avatar Mar 15 '19 00:03 DrewYa