jakesankey / git-history

View previous versions of any file known to git.
https://atom.io/packages/git-history
MIT License
28 stars 10 forks source link

Uncaught TypeError: Cannot read property 'repo' of undefined #20

Closed ChowSinWon closed 9 years ago

ChowSinWon commented 9 years ago

[Enter steps to reproduce below:]

  1. show file history
  2. select revision
  3. error message

Atom Version: 0.204.0 System: KYRILL Thrown From: git-history package, v3.0.0

Stack Trace

Uncaught TypeError: Cannot read property 'repo' of undefined

At /C:/Users/koehl/.atom/packages/git-history/lib/git-history-view.coffee:192

TypeError: Cannot read property 'repo' of undefined
  at GitHistoryView._loadRevision (C:\Users\koehl\.atom\packages\git-history\lib\git-history-view.coffee:120:17)
  at GitHistoryView.confirmed (C:\Users\koehl\.atom\packages\git-history\lib\git-history-view.coffee:112:10)
  at GitHistoryView.module.exports.SelectListView.confirmSelection (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:338:21)
  at space-pen-div.module.exports.SelectListView.initialize.atom.commands.add.core:confirm (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:109:19)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\src\command-registry.js:238:29)
  at __bind (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\src\command-registry.js:3:61)
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:520:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:355:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (C:\Users\koehl\AppData\Local\atom\app-0.204.0\resources\app.asar\src\window-event-handler.js:178:20)

Commands

     -0:14.5.0 git-history:show-file-history (atom-text-editor.editor.is-focused)
     -0:13.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:04.4.0 git-history:show-file-history (atom-text-editor.editor.is-focused)
  2x -0:03.6.0 core:move-down (atom-text-editor.editor.mini.is-focused)
     -0:03.1.0 core:confirm (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "sass-watch",
      "linter-phpcs",
      "slash-closer",
      "remote-edit",
      "emmet",
      "resize-panes",
      "resize-panes",
      "recent-files",
      "compare-files"
    ]
  },
  "git-history": {
    "showDiff": false
  }
}

Installed Packages

# User
atom-color-highlight, v3.0.9
atom-html-preview, v0.1.6
color-picker, v2.0.2
git-go, v1.0.1
git-history, v3.0.0
git-log, v0.4.1
git-tab-status, v1.9.2
highlight-selected, v0.9.3
keyboard-localization, v1.4.0
language-smarty-php, v0.5.0
linter, v0.12.6
linter-csslint, v0.0.13
linter-htmlhint, v0.0.16
linter-jsonlint, v0.1.4
linter-php, v0.0.15
linter-tidy, v1.0.1
minimap, v4.9.0
minimap-color-highlight, v4.1.4
minimap-find-and-replace, v4.2.0
minimap-git-diff, v4.1.3
minimap-highlight-selected, v4.3.0
script, v2.23.0

# Dev
No dev packages
ChowSinWon commented 9 years ago

problem occurs with and without "diff" activated.

repo seems to be undefined in git-history-view.coffee if i change line

(119) repo.repo.workingDirectory.replace(/\\/g, '/')," 

back to

path.dirname(@file),

there is no more error, but i am not sure if that's correct either. it looks good, though.

jakesankey commented 9 years ago

Can you explain your current workspace? Do you just have one root project open or multiple? Do you have multiple git repos active for your current workspace? Perhaps a subtree setup with a top level repo containing another repo?

jakesankey commented 9 years ago

switching it back to path.dirname(@file) doesn't work for me.

peacechen commented 9 years ago

Also seeing this error. Happens whether with a single self-contained repo, or a parent container repo with one submodule. Atom 0.204 / Win7

ChowSinWon's fix works for me as well.

ChowSinWon commented 9 years ago

sorry for late reply. here some answers to your questions:

Can you explain your current workspace? Do you just have one root project open or multiple? Do you have multiple git repos active for your current workspace? Perhaps a subtree setup with a top level repo containing another repo?

workspace consisted of two project folders, where each is one git repository, but no nested repositories.

i just made some debug outputs and found, that paths in this.file have backslashes (due to windows file system) and r.repo.workingDirectory from atom.project.getRepositories() always has common slashes.

this explains why my "fix" worked, since i coincidentally tried to get a diff from first project.

real fix coming up right now, please stand by :)

JohnMurga commented 9 years ago

Thanks @ChowSinWon ! I was facing this issue ... Your pull request fixed it for me :-)

jmcmorris commented 9 years ago

Same as @JohnMurga, I ran into this issue and fixed it using @ChowSinWon's fix. Thanks!

JeffreyArts commented 8 years ago

I am having this issue as well. The only special thing I could imagine is that I do not have set a remote repository, just a local git init.

Atom Version: 1.0.19 System: Mac OS X 10.11 Thrown From: git-history package, v3.1.0

Stack Trace

Uncaught TypeError: Cannot read property 'repo' of undefined

At /Users/jeffreyarts/.atom/packages/git-history/lib/git-history-view.coffee:119

TypeError: Cannot read property 'repo' of undefined
  at GitHistoryView._loadRevision (/Users/jeffreyarts/.atom/packages/git-history/lib/git-history-view.coffee:119:17)
  at GitHistoryView.confirmed (/Users/jeffreyarts/.atom/packages/git-history/lib/git-history-view.coffee:112:10)
  at GitHistoryView.module.exports.SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
  at space-pen-li.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:139:19)
  at HTMLOListElement.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/jquery/dist/jquery.js:4435:9)
  at HTMLOListElement.elemData.handle (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/jquery/dist/jquery.js:4121:28)

Commands

     -8:53.2.0 application:open (atom-text-editor.editor.is-focused)
     -1:05.6.0 find-and-replace:show (atom-text-editor.editor.is-focused)
  2x -1:03.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:03.1.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -1:03.1.0 git-diff-details:close-git-diff-details (atom-text-editor.editor.mini.is-focused)
     -1:03.1.0 core:cancel (atom-text-editor.editor.mini.is-focused)
  2x -0:56.2.0 core:move-down (atom-text-editor.editor.is-focused)
     -0:48.3.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -0:45.3.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:14.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:14.7.0 git-history:show-file-history (atom-text-editor.editor)
     -0:11.9.0 core:move-down (atom-text-editor.editor.mini.is-focused)
     -0:10.1.0 core:move-up (atom-text-editor.editor.mini.is-focused)
     -0:04.9.0 core:confirm (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "seti-monokai"
    ],
    "disabledPackages": [
      "jslint",
      "git-difftool"
    ],
    "excludeVcsIgnoredPaths": false
  }
}

Installed Packages

# User
Sublime-Style-Column-Selection, v1.3.0
atom-beautify, v0.28.11
docblockr, v0.7.2
emmet, v2.3.10
git-diff-details, v0.20.0
git-history, v3.1.0
jshint, v1.8.0
linter, v0.12.7
linter-csslint, v0.0.13
set-syntax, v0.3.0
seti-monokai, v0.3.1

# Dev
No dev packages
qnub commented 8 years ago
  1. Run xommand «Show File History».
  2. Select file version from dropdown.

Atom Version: 1.5.3 System: Ubuntu 15.10 Thrown From: git-history package, v3.2.0

Stack Trace

Uncaught TypeError: Cannot read property 'repo' of undefined

At /home/qnub/.atom/packages/git-history/lib/git-history-view.coffee:120

TypeError: Cannot read property 'repo' of undefined
    at GitHistoryView._loadRevision (/home/qnub/.atom/packages/git-history/lib/git-history-view.coffee:120:17)
    at GitHistoryView.confirmed (/home/qnub/.atom/packages/git-history/lib/git-history-view.coffee:113:10)
    at GitHistoryView.module.exports.SelectListView.confirmSelection (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
    at space-pen-li.<anonymous> (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:139:19)
    at HTMLOListElement.jQuery.event.dispatch (/usr/share/atom/resources/app.asar/node_modules/jquery/dist/jquery.js:4435:9)
    at HTMLOListElement.elemData.handle (/usr/share/atom/resources/app.asar/node_modules/jquery/dist/jquery.js:4121:28)

Commands

     -9:15.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)
  2x -3:15 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-syntax.theme-one-dark-ui)
     -2:57.6.0 split-diff:toggle (atom-text-editor.editor.is-focused)
  4x -2:57.3.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-syntax.theme-one-dark-ui)
     -2:36.3.0 core:close (atom-text-editor.editor.is-focused)
  4x -2:36.3.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-syntax.theme-one-dark-ui)
     -0:11.3.0 git-history:show-file-history (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "ignoredNames": [
      "*.py[co]",
      ".DS_Store"
    ],
    "themes": [
      "one-dark-ui",
      "atom-dark-syntax"
    ]
  },
  "git-history": {}
}

Installed Packages

# User
Stylus, v2.1.2
atom-terminal, v0.8.0
atom-typescript, v8.2.0
autoclose-html, v0.20.0
autocomplete-python, v1.6.1
ctrl-last-tab, v0.3.0
editorconfig, v1.2.4
emmet, v2.4.1
exception-reporting, v0.37.0
file-icons, v1.6.14
git-history, v3.2.0
highlight-selected, v0.11.2
language-django, v0.1.1
language-jade, v0.6.3
language-rust, v0.4.6
linter, v1.11.3
linter-eslint, v6.0.0
linter-pyflakes, v0.2.1
linter-rust, v0.3.0
metrics, v0.53.1
minimap, v4.19.0
minimap-codeglance, v0.4.5
minimap-highlight-selected, v4.3.1
minimap-linter, v1.1.1
minimap-pigments, v0.1.7
minimap-split-diff, v0.3.0
pigments, v0.23.1
project-manager, v2.7.6
release-notes, v0.53.0
split-diff, v0.5.5
symbols-tree-view, v0.11.0
sync-settings, v0.6.0
synced-sidebar, v0.4.3
tabs-to-spaces, v1.0.1
tag, v0.3.0
tasks, v2.6.0

# Dev
No dev packages
GabrielDelepine commented 8 years ago

I do not have set a remote repo

  1. Run xommand «Show File History».
  2. Select file version from dropdown.

Atom Version: 1.5.4 System: Ubuntu 14.04.3 Thrown From: git-history package, v3.2.0

Stack Trace

Uncaught TypeError: Cannot read property 'repo' of undefined

At /home/gabriel/.atom/packages/git-history/lib/git-history-view.coffee:120

TypeError: Cannot read property 'repo' of undefined
    at GitHistoryView._loadRevision (/home/gabriel/.atom/packages/git-history/lib/git-history-view.coffee:120:17)
    at GitHistoryView.confirmed (/home/gabriel/.atom/packages/git-history/lib/git-history-view.coffee:113:10)
    at GitHistoryView.module.exports.SelectListView.confirmSelection (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
    at space-pen-li.<anonymous> (/usr/share/atom/resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:139:19)
    at HTMLOListElement.jQuery.event.dispatch (/usr/share/atom/resources/app.asar/node_modules/jquery/dist/jquery.js:4435:9)
    at HTMLOListElement.elemData.handle (/usr/share/atom/resources/app.asar/node_modules/jquery/dist/jquery.js:4121:28)

Commands

     -8:37.4.0 find-and-replace:show (atom-text-editor.editor.is-focused)
     -8:36.2.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -8:36.2.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -8:35.5.0 project-find:show (atom-text-editor.editor.is-focused)
     -8:34.6.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -8:34.6.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -8:31.4.0 core:undo (atom-text-editor.editor.is-focused.autocomplete-active)
     -6:19.2.0 core:backspace (atom-text-editor.editor.is-focused.autocomplete-active)
     -6:16.8.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
     -6:16.8.0 core:cancel (atom-text-editor.editor.is-focused)
     -0:32 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:24.9.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -0:16.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:16.5.0 git-history:show-file-history (atom-text-editor.editor)

Config

{
  "core": {
    "audioBeep": false,
    "ignoredNames": [
      "*.pot",
      ".git",
      "*.po",
      "*.po~",
      "*.jpg",
      "*.png",
      "*.pdf",
      "*.log",
      "*_Gettext",
      "*.map",
      "vendor",
      "dist"
    ],
    "openEmptyEditorOnStart": false,
    "packagesWithKeymapsDisabled": [
      "zentabs"
    ]
  }
}

Installed Packages

# User
duplicate-line-or-selection, v0.5.0
git-history, v3.2.0
zentabs, v0.8.7

# Dev
No dev packages
mprinc commented 6 years ago

I still have the same problem with the currently latest version 3.3.0. Is there a good reason why this issue is closed?

Pietro-G commented 5 years ago

Is there a particular way to move the pull-request into the integrated build that atom users use? @ChowSinWon 's fix worked, and I believe is already cleared in the pull requests. why is this not in the official build after 2 years?

slingshotpeace commented 5 years ago

I suspect the package needs to be published to Atom's package repository. @jakesankey would you mind publishing an update?

utkarshgupta137 commented 3 years ago

I am getting this issue in 3.3.0 & Atom 1.52.0

RemekConsulting commented 3 years ago

I am getting this issue in version 3.3.0 and Atom 1.53.0. Multiple open projects (each project a repo, no nested repos). One file open and trying to view the Git History. image