 
 git           = require '../../git'
 List          = require '../list'
+StagedFile    = require './staged-file'
 UnstagedFile  = require './unstaged-file'
-StagedFile    = require './staged-file'
 UntrackedFile = require './untracked-file'
 ErrorView     = require '../../views/error-view'
 

  # Internal: Populate the file list.
  #
  # status - The status to populate the file list with as {Object}.
  populate: (status, silent) ->
    @populateList(status.untracked, @untracked(), UntrackedFile)
    @populateList(status.unstaged, @unstaged(), UnstagedFile)
    @populateList(status.staged, @staged(), StagedFile)

    @select(@selectedIndex)
    @trigger('repaint') unless silent

  comparator: (file) ->
    file.sortValue

  # Public: Return the staged files.
  staged: ->

  untracked: ->
    @filter (file) -> file.isUntracked()

  # Internal: Populate the list.
  #
  # files - The files to populate the list with as {Array}.
  # Klass - The Klass these paths are to be tracked as as {Object}.
  populateList: (files, Klass) =>
    _.each files, (file) => @add new Klass(file)

module.exports = FileList
