   # Branch name
   # Returns commit hash when head is detached
   # Returns null in newly-initialized repos (note that isRepo() still returns true in this case)
-  register 'branch',
+  git.register 'branch',
     update: (done) ->
       command = 'git rev-parse --abbrev-ref HEAD 2>/dev/null'
-      Impromptu.exec command, (err, result) ->
+      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) ->
+        impromptu.exec 'git rev-parse --short HEAD', (_err, _result) ->
           done _err, _result
 
   # Short commit hash
-  register 'commit',
-    update: (done) ->
-      Impromptu.exec 'git rev-parse --short HEAD 2>/dev/null', (err, result) ->
+  git.register 'commit',
+    update: (done) ->
+      impromptu.exec 'git rev-parse --short HEAD 2>/dev/null', (err, result) ->
         if err
           done err, null
         else

  # 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}",
      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,
      update: (done) ->
        git["_#{type}"] (err, statuses) ->
          done err, statuses.toString()

  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) ->
          done err, results

  register 'stashCount',
    update: (done) ->
      git.root (err, root) ->
        return done err if err

impromptu = require 'impromptu'
fs = require 'fs'
path = require 'path'

