mirror of
https://github.com/atom/atom.git
synced 2026-02-12 23:55:10 -05:00
Add Git.destroy() that frees native repository
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
Subscriber = require 'subscriber'
|
||||
|
||||
module.exports =
|
||||
class Git
|
||||
@@ -23,12 +25,17 @@ class Git
|
||||
|
||||
constructor: (path) ->
|
||||
@repo = new GitRepository(path)
|
||||
$(window).on 'focus', => @refreshIndex()
|
||||
@subscribe $(window), 'focus', => @refreshIndex()
|
||||
|
||||
refreshIndex: -> @repo.refreshIndex()
|
||||
|
||||
getPath: -> @repo.getPath()
|
||||
|
||||
destroy: ->
|
||||
@repo.destroy()
|
||||
@repo = null
|
||||
@unsubscribe()
|
||||
|
||||
getWorkingDirectory: ->
|
||||
repoPath = @getPath()
|
||||
repoPath?.substring(0, repoPath.length - 6)
|
||||
@@ -85,3 +92,5 @@ class Git
|
||||
|
||||
isSubmodule: (path) ->
|
||||
@repo.isSubmodule(@relativize(path))
|
||||
|
||||
_.extend Git.prototype, Subscriber
|
||||
|
||||
@@ -34,6 +34,8 @@ class Project
|
||||
grammarOverridesByPath: @grammarOverridesByPath
|
||||
|
||||
destroy: ->
|
||||
@repo?.destroy()
|
||||
@repo = null
|
||||
editSession.destroy() for editSession in @getEditSessions()
|
||||
|
||||
addGrammarOverrideForPath: (path, grammar) ->
|
||||
|
||||
Reference in New Issue
Block a user