Class: Git::Commands::CatFile::Filtered Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/cat_file/filtered.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.

Note:

arguments block audited against https://git-scm.com/docs/git-cat-file/2.53.0

Retrieves a single git object after applying working-tree filter processing

Runs git cat-file with --textconv or --filters. Both modes require the caller to identify the object by revision and path so that git can look up the applicable .gitattributes rules:

  • --textconv — apply only the textconv filter (binary-to-text conversion defined by diff.<driver>.textconv in .gitattributes); intended for human-readable display
  • --filters — apply the full working-tree pipeline: smudge filter, EOL conversion, and textconv; returns the content exactly as git checkout would write it to disk

The object can be identified as a combined <rev>:<path> string passed as the rev operand, or as a bare <rev> with --path=<path> supplied separately.

For unfiltered object access, use Raw. For batch queries across multiple objects, use Batch.

Instance Method Summary collapse

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(rev, textconv: true, **options) ⇒ Git::CommandLineResult #call(rev, filters: true, **options) ⇒ Git::CommandLineResult

Execute git cat-file --textconv or git cat-file --filters.

Overloads:

  • #call(rev, textconv: true, **options) ⇒ Git::CommandLineResult

    Apply the textconv filter to a single object

    Parameters:

    • rev (String)

      combined <rev>:<path> identifier (e.g. HEAD:README.md), or a bare revision when path: is also given

    • textconv (Boolean) (defaults to: true)

      enable textconv mode

    • options (Hash)

      command options

    Options Hash (**options):

    • :path (String) — default: nil

      Path to the blob when rev is a bare revision

    Returns:

    • (Git::CommandLineResult)

      the result of calling git cat-file

      Stdout contains the textconv-processed content

    Raises:

    • (ArgumentError)

      if unsupported options are provided

    • (Git::FailedError)

      if the object does not exist or the path is missing

  • #call(rev, filters: true, **options) ⇒ Git::CommandLineResult

    Apply the full working-tree filter pipeline to a single object

    Parameters:

    • rev (String)

      combined <rev>:<path> identifier (e.g. HEAD:README.md), or a bare revision when path: is also given

    • filters (Boolean) (defaults to: true)

      enable full filter pipeline mode

    • options (Hash)

      command options

    Options Hash (**options):

    • :path (String) — default: nil

      Path to the blob when rev is a bare revision

    Returns:

    • (Git::CommandLineResult)

      the result of calling git cat-file

      Stdout contains the filter-processed content

    Raises:

    • (ArgumentError)

      if unsupported options are provided

    • (Git::FailedError)

      if the object does not exist or the path is missing



# File 'lib/git/commands/cat_file/filtered.rb', line 59