atom/git-diff

Uncaught Error: Repository has been destroyed

Closed this issue · 14 comments

[Enter steps to reproduce below:]

just started atom after upgrade

Atom Version: 0.183.0
System: linux 3.18.6-1-ARCH
Thrown From: git-diff package, v0.53.0

Stack Trace

Uncaught Error: Repository has been destroyed

At /usr/share/atom/resources/app/src/git-repository.js:394

Error: Repository has been destroyed
  at GitRepository.module.exports.GitRepository.getRepo (/usr/share/atom/resources/app/src/git-repository.js:394:15)
  at GitRepository.module.exports.GitRepository.getLineDiffs (/usr/share/atom/resources/app/src/git-repository.js:309:19)
  at GitDiffView.module.exports.GitDiffView.updateDiffs (/usr/share/atom/resources/app/node_modules/git-diff/lib/git-diff-view.js:151:99)
  at /usr/share/atom/resources/app/node_modules/git-diff/lib/git-diff-view.js:3:61
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at /usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:1151:25

Commands

Config

{
  "core": {
    "excludeVcsIgnoredPaths": false,
    "disabledPackages": [
      "welcome",
      "metrics",
      "autocomplete",
      "incremental-search",
      "Tern",
      "grunt-runner",
      "tree-view-open-files",
      "tree-view-breadcrumb",
      "atomatigit",
      "symbols-view",
      "themed-settings",
      "spell-check",
      "linter-scspell",
      "symbol-gen"
    ],
    "themes": [
      "one-dark-ui",
      "solarized-dark-syntax"
    ],
    "projectHome": "/home/despairblue/vcs/git/",
    "destroyEmptyPanes": false,
    "autoHideMenuBar": true
  }
}

Installed Packages

# User
atom-color-highlight, v3.0.8
atom-jasmine, v0.5.0
atom-ternjs, v0.4.18
autocomplete-paths, v1.0.2
autocomplete-plus, v2.1.6
autocomplete-snippets, v1.0.1
block-travel, v1.0.2
bug-report, v0.6.1
color-picker, v1.4.4
compare-files, v0.4.1
docblockr, v0.5.8
file-icons, v1.4.11
filetype-color, v0.1.4
git-log, v0.2.0
go-plus, v3.2.2
grammar-token-limit, v0.1.1
highlight-line, v0.9.3
highlight-selected, v0.9.0
indentation-indicator, v0.4.1
javascript-snippets, v1.0.0
keybinding-cheatsheet, v0.0.7
linter, v0.11.1
linter-coffeelint, v0.1.7
linter-htmlhint, v0.0.8
linter-js-yaml, v0.1.3
linter-jshint, v0.1.0
linter-lua, v0.1.3
linter-puppet-lint, v0.2.8
linter-shellcheck, v0.0.6
minimap, v4.1.4
minimap-color-highlight, v4.0.0
minimap-find-and-replace, v3.1.0
minimap-git-diff, v3.1.1
minimap-highlight-selected, v4.0.0
neon-cursor, v0.2.0
neon-selection, v0.3.2
open-last-project, v0.2.2
project-manager, v1.15.5
regex-railroad-diagram, v0.6.3
tab-smart-sort, v0.1.2
tabs-to-spaces, v0.8.1
test-status, v0.27.1
travis-ci-status, v0.11.2
view-tail-large-files, v0.1.10
zentabs, v0.8.2

# Dev
No dev packages

is thrown 4 times in a row

oh and restarting atom does not surface the error again. 😕

Reloading Atom makes the error appear again for me.

My temporary workaround is to go to Settings and disable the git-diff package.

I'm having trouble reproducing this. @bolinfest did I understand correctly that these steps trigger the issue for you:

  1. start Atom from the root of a Git repository
  2. execute the Window: Reload command

Also, which OS and Atom version are you on exactly?

@izuzak I'm programmatically opening multiple root folders via atom.project.setPaths() and only two of the three folders have a Git repository.

Thanks @bolinfest. Still having trouble reproducing -- just ran this (first two are Git repositories, last one isn't) and didn't see the exception:

atom.project.setPaths(["/Users/izuzak/github/atom", "/Users/izuzak/github/atom-pdf-view", "/Users/izuzak/Documents"])

I'm trying to reproduce this too. It looks like the stack trace leads to @emitter.emit "did-stop-changing in text-buffer. Maybe it's a race condition that involves calling .setPaths right after the editor's contents have changed?

Yeah. This reproduces it for me, regardless of whether the path is a git repo or not:

atom.workspace.getActiveTextEditor().insertText(" ") && atom.project.setPaths([ "a-path" ])

I am getting this error. I am still not sure what started it.

Here is the stack trace:

Error: Repository has been destroyed
  at GitRepository.module.exports.GitRepository.getRepo (/usr/share/atom/resources/app.asar/src/git-repository.js:382:15)
  at GitRepository.module.exports.GitRepository.getLineDiffs (/usr/share/atom/resources/app.asar/src/git-repository.js:297:19)
  at GitDiffView.module.exports.GitDiffView.updateDiffs (/usr/share/atom/resources/app.asar/node_modules/git-diff/lib/git-diff-view.js:160:99)
  at /usr/share/atom/resources/app.asar/node_modules/git-diff/lib/git-diff-view.js:3:61
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at /usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1219:25

I'll try to find out how to re-create...

Error report:
I started getting this error message after editing my init script to sort project directories alphabetically.

  1. Added code to init.coffee
  2. Restarted Atom

Code:

arrayEqual = (a, b) ->
    a.length is b.length and a.every (elem, i) -> elem is b[i]

sortPaths = (projectPaths) ->
    paths = atom.project.getPaths()
    paths.sort()
    if not arrayEqual(paths, projectPaths)
        atom.project.setPaths(paths)

sortPaths([])
atom.project.onDidChangePaths(sortPaths)

Atom Version: 1.5.3
System: linux 4.1.15-gentoo-r1
Thrown From: git-diff package, v0.57.0

Stack Trace

Uncaught Error: Repository has been destroyed

At /usr/share/atom/resources/app.asar/src/git-repository.js:358

Error: Repository has been destroyed
    at GitRepository.module.exports.GitRepository.getRepo (/usr/share/atom/resources/app.asar/src/git-repository.js:358:15)
    at GitRepository.module.exports.GitRepository.getLineDiffs (/usr/share/atom/resources/app.asar/src/git-repository.js:292:19)
    at GitDiffView.module.exports.GitDiffView.updateDiffs (/usr/share/atom/resources/app.asar/node_modules/git-diff/lib/git-diff-view.js:160:68)
    at Immediate._onImmediate (/usr/share/atom/resources/app.asar/node_modules/git-diff/lib/git-diff-view.js:3:61)
    at processImmediate [as _immediateCallback] (timers.js:374:17)
    at EventEmitter.ipc.sendSync (/usr/share/atom/resources/atom.asar/renderer/api/lib/ipc.js:21:31)
    at BrowserWindow.Object.defineProperty.get [as loadSettings] (/usr/share/atom/resources/atom.asar/renderer/api/lib/remote.js:160:27)
    at Object.windowState (/usr/share/atom/resources/app.asar/src/window-load-settings-helpers.js:17:39)
    at Object.stringify (native)
    at exports.setWindowLoadSettings (/usr/share/atom/resources/app.asar/src/window-load-settings-helpers.js:27:52)
    at ApplicationDelegate.module.exports.ApplicationDelegate.setRepresentedDirectoryPaths (/usr/share/atom/resources/app.asar/src/application-delegate.js:172:14)
    at /usr/share/atom/resources/app.asar/src/atom-environment.js:844:44
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at Project.module.exports.Project.setPaths (/usr/share/atom/resources/app.asar/src/project.js:217:27)
    at sortPaths (/home/bschmoll/.atom/init.coffee:20:22)
    at Object.<anonymous> (/home/bschmoll/.atom/init.coffee:22:1)
    at Object.<anonymous> (/home/bschmoll/.atom/init.coffee:13:1)
    at Module._compile (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (/usr/share/atom/resources/app.asar/src/compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:50:27)
    at AtomEnvironment.module.exports.AtomEnvironment.requireUserInitScript (/usr/share/atom/resources/app.asar/src/atom-environment.js:974:20)
    at AtomEnvironment.module.exports.AtomEnvironment.startEditorWindow (/usr/share/atom/resources/app.asar/src/atom-environment.js:691:14)
    at module.exports (/usr/share/atom/resources/app.asar/src/initialize-application-window.js:28:10)
    at setupWindow (file:///usr/share/atom/resources/app.asar/static/index.js:86:5)
    at window.onload (file:///usr/share/atom/resources/app.asar/static/index.js:41:9)

Commands

Config

{
  "core": {
    "audioBeep": false,
    "disabledPackages": [
      "open-on-github",
      "metrics",
      "background-tips"
    ],
    "openEmptyEditorOnStart": false,
    "projectHome": "/home/bschmoll/gitspace",
    "themes": [
      "atom-dark-ui",
      "schmolli-syntax"
    ]
  }
}

Installed Packages

# User
atom-grails, v0.1.0
cursor-history, v0.5.9
double-click-tree-view, v1.1.0
language-groovy, v0.5.0
remote-edit, v1.8.24
schmolli-syntax, v0.0.0
vim-mode, v0.64.0

# Dev
No dev packages

I'm having the exact same issue and same cause (sort paths) as @schmolly159 above.

And the reason we're posting here in an old issue is Atom tells us "The error was thrown from the git-diff package. This issue has already been reported. View Issue". Happy to open a new issue if necessary...

@joshuajabbour Yeah, a new issue would be appreciated. The notifications package isn't advanced enough yet to figure out that these are two different bugs.