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
Public Instance Methods
Source
# File lib/git/commands/archive.rb, line 142 def chomp_captured_stdout? = false end
Archive output is binary, so preserve captured stdout byte-for-byte even when it ends with a newline.
@return [Boolean] ‘false`
Source
# File lib/git/commands/archive.rb, line 135 def normalize_captured_stdout? = false # Archive output is binary, so preserve captured stdout byte-for-byte # even when it ends with a newline. # # @return [Boolean] `false` # def chomp_captured_stdout? = false end end
Archive output is intrinsically binary (tar, zip, etc.) — opt out of Ruby string normalization and trailing-newline chomping so that ‘result.stdout` bytes are returned unchanged. Only affects the capturing path; streaming via `out:` is never normalized or chomped regardless of these settings.
@return [Boolean] ‘false`