# File lib/git/lib.rb, line 588
    def archive(sha, file = nil, opts = {})
      opts[:format] = 'zip' if !opts[:format]
      
      if opts[:format] == 'tgz'
        opts[:format] = 'tar' 
        opts[:add_gzip] = true
      end
      
      if !file
        file = Tempfile.new('archive').path
      end
      
      arr_opts = []
      arr_opts << "--format=#{opts[:format]}" if opts[:format]
      arr_opts << "--prefix=#{opts[:prefix]}" if opts[:prefix]
      arr_opts << "--remote=#{opts[:remote]}" if opts[:remote]
      arr_opts << sha
      arr_opts << opts[:path] if opts[:path]
      arr_opts << '| gzip' if opts[:add_gzip]
      arr_opts << "> #{file.to_s}"
      command('archive', arr_opts)
      return file
    end