       @itemTitle.classList.remove('status-ignored', 'status-modified',  'status-added')
       @itemTitle.classList.add("status-#{@status}") if @status
 
-  repoForPath: (goalPath) ->
-    for projectPath, i in atom.project.getPaths()
-      if goalPath is projectPath or goalPath.indexOf(projectPath + path.sep) is 0
-        return atom.project.getRepositories()[i]
-    null
-
 module.exports = document.registerElement('tabs-tab', prototype: TabView.prototype, extends: 'li')

      @modifiedSubscription = dispose: =>
        @item.off?('modified-status-changed', modifiedHandler)

    @configSubscription = atom.config.observe 'tabs.showIcons', =>
      @updateIconVisibility()


      @classList.remove('modified') if @isModified
      @isModified = false

  setupVcsStatus: ->
    return unless @path?
    repo = @repoForPath(@path)
    @subscribeToRepo(repo)
    @updateVcsStatus(repo)

  # Subscribe to the project's repo for changes to the VCS status of the file.
  subscribeToRepo: (repo) ->
    return unless repo?

    # Remove previous repo subscriptions.
    @subscriptions?.dispose()

    @subscriptions.add repo.onDidChangeStatus (event) =>
      @updateVcsStatus(repo) if @path is event.path
    @subscriptions.add repo.onDidChangeStatuses =>
      @updateVcsStatus(repo)

  repoForPath: (goalPath) ->
    for projectPath, i in atom.project.getPaths()
      if goalPath is projectPath or goalPath.indexOf(projectPath + path.sep) is 0
        return atom.project.getRepositories()[i]
    null

  # Update the VCS status property of this tab using the repo.
  updateVcsStatus: (repo) ->
    return unless repo?

    newStatus = null
