   # 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',
+  register 'branch',
     update: (done) ->
       branch = repo?.getShortHead()
       done null, branch
 
   # Determine whether the repo is currently in a detached head state
   # This happens when you checkout, for example, a commit hash
-  @register 'isDetachedHead',
+  register 'isDetachedHead',
     update: (done) ->
       branch = repo?.getHead()
       done null, ! /^refs\/heads\//.test branch

    STATUS_CODE_MAP[status.code]?.desc is desc


module.exports = (Impromptu, git) ->
  # Expose the repo object from the git-utils library
  # This will be null when we're not in a repo
  @register '_repo',
    update: (done) ->
      done null, repo

  # Helper to figure out if we're in a repo at all
  @register 'isRepo',
    update: (done) ->
      done null, !! repo

  # Root path to the repository
  @register 'root',
    update: (done) ->
      root = repo?.getPath().replace /\.git\/$/, ''
      done null, root


  # Get the number of modified files
  # Does not matter whether or not they are staged
  register 'modified',
    update: (done) ->
      git._status (err, statuses) ->
        count = _filter_statuses_by_desc(statuses, 'modified').length
