Class: Git::Commands::CatFile::Raw Private
- Defined in:
- lib/git/commands/cat_file/raw.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
arguments block audited against https://git-scm.com/docs/git-cat-file/2.53.0
Queries a single git object by name passed as a CLI argument
Runs git cat-file in non-batch mode. Exactly one mode flag or a <type>
operand must be supplied:
-e— exit 0 if the object exists and is valid, exit 1 otherwise; no output is written to stdout-t— print the object type (blob,tree,commit, ortag)-s— print the object size in bytes-p— pretty-print the object content (format varies by type)<type>— print the raw content after validating the object is of the given type (or trivially dereferenceable to it)
For queries across multiple objects, use Batch. For filter-processed content, use Filtered.
Instance Method Summary collapse
-
#call
private
Execute
git cat-filefor a single object.
Methods inherited from Base
allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation
Constructor Details
This class inherits a constructor from Git::Commands::Base
Instance Method Details
#call(object, e: true, **options) ⇒ Git::CommandLineResult #call(object, t: true, **options) ⇒ Git::CommandLineResult #call(object, s: true, **options) ⇒ Git::CommandLineResult #call(object, p: true, **options) ⇒ Git::CommandLineResult #call(type, object, **options) ⇒ Git::CommandLineResult
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute git cat-file for a single object.
Exactly one mode must be selected: pass one of e: true, p: true,
t: true, s: true, or a positional type argument.
194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/git/commands/cat_file/raw.rb', line 194 def call(*, **) bound = args_definition.bind(*, **) validate_version! result = execute_command(bound) # `-e` treats exit 1 as a meaningful result (object not found), but any other # non-zero exit (e.g. 128 for a corrupt object database) is still a failure. # All other modes treat every non-zero exit as a failure. allowed = result.status.success? || (bound.e? && result.status.exitstatus == 1) raise Git::FailedError, result unless allowed result end |