     @updateIcon()
     @updateModifiedStatus()
     @setupTooltip()
-
-    if @path
-      repo = @repoForPath(@path)
-      @subscribeToRepo(repo)
-      @updateStatus(repo)
+    @setupVcsStatus()
 
   handleEvents: ->
     titleChangedHandler = =>

    @iconSubscription?.dispose()
    @mouseEnterSubscription?.dispose()
    @configSubscription?.dispose()
    @subscriptions?.dispose()
    @destroyTooltip()
    @remove()

      @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
