     @subscriptions = new CompositeDisposable()
     @decorations = {}
     @markers = []
+    @indexWatch = null
     @timeoutId = @repository = @editor = null
 
   dispose: =>
     @cancelUpdate()
     @removeDecorations()
+    @indexWatch?.close()
     @subscriptions?.dispose()
     @reset()
 

      @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)

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

