   # Strings are formatted as "∆2 +1 -3" by default.
   ['staged', 'unstaged', 'added', 'modified', 'deleted'].forEach (type) ->
     # Get an object that has filtered the statuses by type.
-    register "_#{type}",
+    git.register "_#{type}",
       update: (done) ->
         git._status (err, statuses) ->
           done err, new Statuses statuses[type]
 
     # Get a string that represents the status.
     # Format: "∆2 +1 -3"
-    register type,
+    git.register type,
       update: (done) ->
         git["_#{type}"] (err, statuses) ->
           done err, statuses.toString()
 
-  register 'fetch',
+  git.register 'fetch',
     cache: 'repository'
     expire: 60
     update: (done) ->
       git.isRepo (err, isRepo) ->
         return done err, isRepo unless isRepo
 
-        Impromptu.exec 'git fetch --all', (err, results) ->
+        impromptu.exec 'git fetch --all', (err, results) ->
           done err, results
 
-  register 'stashCount',
+  git.register 'stashCount',
     update: (done) ->
       git.root (err, root) ->
         return done err if err

        fs.exists path.join(root, '.git/logs/refs/stash'), (exists) ->
          return done null, 0 unless exists

          Impromptu.exec "wc -l #{path.join root, '.git/logs/refs/stash'}", (err, count) ->
            done err, parseInt count.trim(), 10

  register 'remoteUrl',
    update: (done) ->
      Impromptu.exec 'git config --get remote.origin.url', done

  # Register the git repository.
  @repository.register 'git',
    root: git.root
    branch: git.branch
    commit: git.commit

  # Branch name
  # Returns commit hash when head is detached
  # Returns null in newly-initialized repos (note that isRepo() still returns true in this case)
  git.register 'branch',
    update: (done) ->
      command = 'git rev-parse --abbrev-ref HEAD 2>/dev/null'
      impromptu.exec command, (err, result) ->
        return done err, null if err

        result = result.trim()
        return done err, result unless result is 'HEAD'

        impromptu.exec 'git rev-parse --short HEAD', (_err, _result) ->
          done _err, _result

  # Short commit hash
  git.register 'commit',
    update: (done) ->
      impromptu.exec 'git rev-parse --short HEAD 2>/dev/null', (err, result) ->
        if err
          done err, null
        else
