prrrnd / atom-git-projects

List and open your local Git projects in Atom.
MIT License
37 stars 18 forks source link

Uncaught TypeError: Cannot read property 'getShortHead' of null #22

Closed erkattak closed 9 years ago

erkattak commented 9 years ago

[Enter steps to reproduce below:]

  1. toggle git-projects

Atom Version: 0.188.0 System: Mac OS X 10.10.2 Thrown From: git-projects package, v1.12.0

Stack Trace

Uncaught TypeError: Cannot read property 'getShortHead' of null

At /Users/erik/.atom/packages/git-projects/lib/models/project.coffee:15

TypeError: Cannot read property 'getShortHead' of null
  at Project.module.exports.Project.branch (/Users/erik/.atom/packages/git-projects/lib/models/project.coffee:15:15)
  at Object.content (/Users/erik/.atom/packages/git-projects/lib/views/projects-list-view.coffee:64:30)
  at Builder.tag (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:281:19)
  at Function.View.(anonymous function) (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:83:49)
  at Object.content (/Users/erik/.atom/packages/git-projects/lib/views/projects-list-view.coffee:62:10)
  at Builder.tag (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:281:19)
  at Function.View.(anonymous function) (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:83:49)
  at Function.<anonymous> (/Users/erik/.atom/packages/git-projects/lib/views/projects-list-view.coffee:60:8)
  at Function.View.buildHtml (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:123:10)
  at Function.View.render (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:129:19)
  at exports.$$ (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/node_modules/space-pen/lib/space-pen.js:627:24)
  at ProjectsListView.module.exports.ProjectsListView.viewForItem (/Users/erik/.atom/packages/git-projects/lib/views/projects-list-view.coffee:59:5)
  at ProjectsListView.module.exports.SelectListView.populateList (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/lib/select-list-view.js:206:29)
  at ProjectsListView.module.exports.SelectListView.setItems (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-space-pen-views/lib/select-list-view.js:167:12)
  at /Users/erik/.atom/packages/git-projects/lib/views/projects-list-view.coffee:54:8

Commands

     -1:06.8 git-projects:toggle (atom-text-editor.editor)
     -0:32.9 settings-view:open (a.btn-issue.btn.btn-error)
  2x -0:20.1 git-projects:toggle (atom-text-editor.editor.mini)
     -0:10.9 core:cancel (input#git-projects.showSubRepos)
  2x -0:02.8 git-projects:toggle (div.settings-view.pane-item)

Config

{
  "core": {
    "ignoredNames": [
      ".git",
      ".svn",
      ".DS_Store"
    ],
    "themes": [
      "atom-dark-ui-slim",
      "one-dark-syntax"
    ],
    "projectHome": "/Users/erik/Code",
    "disabledPackages": [
      "tabs",
      "tree-view",
      "autocomplete"
    ]
  },
  "git-projects": {
    "sortBy": "Latest modification date",
    "rootPath": "/Users/erik/Code"
  }
}

Installed Packages

# User
atom-dark-ui-slim, v0.47.1
autocomplete-plus, v2.7.0
color-picker, v1.5.0
file-icons, v1.5.2
gist-it, v0.6.9
git-projects, v1.12.0
highlight-selected, v0.9.1
language-haml, v0.17.0
pretty-json, v0.3.2
react, v0.10.1
related-files, v0.3.0
sublime-tabs, v0.5.2
subword-navigation, v2.5.3

# Dev
No dev packages
prrrnd commented 9 years ago

Thank you for reporting the issue. It seems like one of your projects in /Users/erik/Code is not a valid Git repository. Do you happen to have a folder containing a .git that is not a repo? I have been able to reproduce this error by creating an empty .git folder. I'm going to improve the way Git repositories are detected.

erkattak commented 9 years ago

You are correct, there were two directories within Code that were not git repositories.

prrrnd commented 9 years ago

Ok, the next release should fix this kind of issues.