     # This is updated every time the Remote Updater fetches
     lastSeenSha: null
 
+    initialize: () ->
+      # If the session config changes then clear the lastSeenSha because it may point to a different repo
+      session.on 'change', () =>
+        @lastSeenSha = null
+
     start: () ->
       # Get the current repo and last commit
       # Periodically check the commits list

                  filePath = file.filename
                  model = allContent.get(filePath)

                  if model
                    # TODO: Just invalidate the model by clearing `isLoaded`
                    return model.reload().then () =>
                      attributes =


      # Return a promise that is resolved once a start hash has been recorded
      # Note: This promise may still fail
      @_runningPromise = @pollUpdates()
      return @_runningPromise

    stop: () ->
      promise = @_runningPromise or (new $.Deferred()).resolve(@)

      return promise.always () =>
        @keepUpdating = false
        @lastSeenSha = null


    # Returns a promise that is resolved when `@lastSeenSha` has been set.
    pollUpdates: () ->
      return if not @keepUpdating

      throw new Error('BUG! remoteUpdater seems to be running twice. did you change repos?') if @_runningPromise
      @_runningPromise = allContent.load().then () =>
        branch = session.getBranch()

        return branch.getCommits().then (commits) =>
          lastUpdatedSha = @lastSeenSha

          lastSeenSha = commits[0].sha

          if not lastUpdatedSha
            @lastSeenSha = lastSeenSha
