         @refreshIndex()
         @refreshStatus()
 
-    if atom.project?
-      @subscribe atom.project.buffers.onEach (buffer) => @subscribeToBuffer(buffer)
+    if @project?
+      @subscribe @project.buffers.onEach (buffer) => @subscribeToBuffer(buffer)
 
   # Private: Subscribes to buffer events.
   subscribeToBuffer: (buffer) ->


    @statuses = {}
    @upstream = {ahead: 0, behind: 0}
    {project, refreshOnWindowFocus} = options

    refreshOnWindowFocus ?= true
    if refreshOnWindowFocus

  # Public: Returns true if at the root, false if in a subfolder of the
  # repository.
  isProjectAtRoot: ->
    @projectAtRoot ?= @project?.relativize(@getWorkingDirectory()) is ''

  # Public: Makes a path relative to the repository's working directory.
  relativize: (path) -> @getRepo().relativize(path)
