       if path = buffer.getPath()
         @getPathStatus(path)
 
-    @subscribe buffer.onDidSave(getBufferPathStatus)
-    @subscribe buffer.onDidReload(getBufferPathStatus)
-    @subscribe buffer.onDidChangePath(getBufferPathStatus)
-    @subscribe buffer.onDidDestroy => @unsubscribe(buffer)
+    bufferSubscriptions = new CompositeDisposable
+    bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus)
+    bufferSubscriptions.add buffer.onDidReload(getBufferPathStatus)
+    bufferSubscriptions.add buffer.onDidChangePath(getBufferPathStatus)
+    bufferSubscriptions.add buffer.onDidDestroy =>
+      bufferSubscriptions.dispose()
+      @subscriptions.remove(bufferSubscriptions)
 
   # Subscribes to editor view event.
   checkoutHeadForEditor: (editor) ->


  constructor: (path, options={}) ->
    @emitter = new Emitter
    @repo = GitUtils.open(path)
    unless @repo?
      throw new Error("No Git repository found searching path: #{path}")

module.exports =
class GitRepository
  EmitterMixin.includeInto(this)

  @exists: (path) ->
    if git = @open(path)
