 fs = require 'fs'
-{join} = require 'path'
 {Directory, CompositeDisposable} = require 'atom'
 {repositoryForPath} = require './helpers'
 

      @scheduleUpdate()
      # Watch the directory because index is recreated on every change.
      # Otherwise we loose the watch after the first change.
      fs.watch join(@repository.path), (__, name)=> @scheduleUpdate() if name is 'index'

  cancelUpdate: ->
    clearTimeout(@timeoutId)

    @subscriptions = new CompositeDisposable()
    @decorations = {}
    @markers = []
    @indexWatch = null
    @timeoutId = @repository = @editor = null

  dispose: =>
    @cancelUpdate()
    @removeDecorations()
    @indexWatch?.close()
    @subscriptions?.dispose()
    @reset()

