class Git::Commands::Archive

Archive creator for files from a named tree via ‘git archive`

Produces an archive of the specified format containing the tree structure for the named tree, and writes it to stdout (or to a file when ‘out:` or `output:` is given). If `prefix:` is specified it is prepended to the filenames in the archive.

@example Archive HEAD as a tar stream to a file

cmd = Git::Commands::Archive.new(execution_context)
File.open('release.tar', 'wb') do |f|
  cmd.call('HEAD', format: 'tar', out: f)
end

@example Archive a tag with a prefix

cmd = Git::Commands::Archive.new(execution_context)
cmd.call('v1.0', format: 'zip', prefix: 'myproject-1.0/', output: 'release.zip')

@example Archive a subdirectory only

cmd = Git::Commands::Archive.new(execution_context)
cmd.call('HEAD', 'src/', format: 'tar', out: io)

@note ‘arguments` block audited against git-scm.com/docs/git-archive/2.53.0

@see Git::Commands

@see git-scm.com/docs/git-archive git-archive

@api private