def add(path, prefix = nil)
      path   = File.expand_path path
      prefix ||= '/'
      in_work_tree File.dirname(path) do
        index = @git.index
        index.read_tree 'HEAD'
        add = lambda do |f, p|
          file = File.basename f
          pre  = (p == '/') ? file : File.join(p, file)
          dir  = File.stat(f).directory?
          if dir
            (Dir.entries(f) - %w{. ..}).each do |child|
              add.call File.join(f, child), pre
            end
          else
            index.add pre, IO.read(f)
          end
          dir
        end
        dir = add.call path, prefix
        type = dir ? 'directory' : 'file'
        commit_msg = "Added #{type} #{path} into '#{prefix}'"
        index.commit commit_msg, [@git.head.commit.sha]
      end
    end
def add(path, prefix = nil)
      path   = File.expand_path path
      prefix ||= '/'
      in_work_tree File.dirname(path) do
        index = @git.index
        index.read_tree 'HEAD'
        add = lambda do |f, p|
          file = File.basename f
          pre  = (p == '/') ? file : File.join(p, file)
          dir  = File.stat(f).directory?
          if dir
            (Dir.entries(f) - %w{. ..}).each do |child|
              add.call File.join(f, child), pre
            end
          else
            index.add pre, IO.read(f)
          end
          dir
        end
        dir = add.call path, prefix
        type = dir ? 'directory' : 'file'
        commit_msg = "Added #{type} #{path} into '#{prefix}'"
        index.commit commit_msg, [@git.head.commit.sha]
      end
    end
Creates a new repository instance on the given path

 @param [Hash] options A hash of options
 @option options [Boolean] :create (true) Creates the backing Git
         repository if it does not already exist
 @option options [Boolean] :prepare (true) Prepares the backing Git
         repository for use with Silo if not already done

 @raise [Grit::InvalidGitRepositoryError] if the path exists, but is not a
        valid Git repository
 @raise [Grit::NoSuchPathError] if the path does not exist and option
        :create is +false+
 @raise [InvalidRepositoryError] if the path contains another Git
        repository that does not contain data managed by Silo.
 Stores a file or full directory structure into the repository inside an
 optional prefix path

 This adds one commit to the history of the repository including the file
 or directory structure. If the file or directory already existed inside
 the prefix, Git will only save the changes.

 @param [String] path The path of the file or directory to store into the
        repository
 @param [String] prefix An optional prefix where the file is stored inside
        the repository