   # 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


  # Determine whether the repo is currently in a detached head state
  # This happens when you checkout, for example, a commit hash
  register 'isDetachedHead',
    update: (done) ->
      Impromptu.exec 'git symbolic-ref HEAD 2>/dev/null', (err) ->
        done err, !! err

  register 'remoteBranch',
    update: (done) ->
      tracking_branch_command = "git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)"
      Impromptu.exec tracking_branch_command, (err, result) ->
        if result
          done err, result.trim()
        else

        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

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

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