Class: Git::Commands::ReadTree Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/read_tree.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-read-tree/2.53.0

Implements the git read-tree command

Reads tree information into the index. Optionally performs a merge (single-tree, two-way fast-forward, or three-way) with the -m flag, and updates the working tree files with -u.

Examples:

Read a single tree into the index

read_tree = Git::Commands::ReadTree.new(execution_context)
result = read_tree.call('HEAD')

Read a tree under a prefix directory

read_tree = Git::Commands::ReadTree.new(execution_context)
result = read_tree.call('HEAD', prefix: 'subdir/')

Perform a three-way merge

read_tree = Git::Commands::ReadTree.new(execution_context)
result = read_tree.call('base', 'ours', 'theirs', m: true, u: true)

Empty the index

read_tree = Git::Commands::ReadTree.new(execution_context)
result = read_tree.call(empty: true)

See Also:

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(*tree_ish, **options) ⇒ Git::CommandLineResult

Execute the git read-tree command

Parameters:

  • tree_ish (Array<String>)

    zero or more tree-ish objects to read into the index

    Pass one tree-ish for a simple read or single-tree merge, two for a fast-forward (two-way) merge, or three for a three-way merge. Omit when using the :empty option.

  • options (Hash)

    command options

Options Hash (**options):

  • :m (Boolean, nil) — default: nil

    perform a merge, not just a read

  • :trivial (Boolean, nil) — default: nil

    restrict three-way merge to happen only if there is no file-level merging required

  • :aggressive (Boolean, nil) — default: nil

    resolve a few more three-way merge cases internally beyond the trivial defaults

  • :reset (Boolean, nil) — default: nil

    same as -m, except that unmerged entries are discarded instead of failing

  • :prefix (String) — default: nil

    keep the current index contents, and read the named tree-ish under the directory at the given prefix

    Maps to --prefix=<prefix>.

  • :u (Boolean, nil) — default: nil

    after a successful merge, update the files in the work tree with the result

  • :i (Boolean, nil) — default: nil

    disable the check with the working tree, meant for creating a merge of trees not directly related to the current working tree status

  • :dry_run (Boolean, nil) — default: nil

    check if the command would error out, without updating the index or files for real

    Alias: :n

  • :v (Boolean, nil) — default: nil

    show the progress of checking files out

  • :index_output (String) — default: nil

    write the resulting index in the named file instead of $GIT_INDEX_FILE

    Maps to --index-output=<file>.

  • :recurse_submodules (Boolean, nil) — default: nil

    update the content of all active submodules according to the commit recorded in the superproject (--recurse-submodules)

  • :no_recurse_submodules (Boolean, nil) — default: nil

    disable recursive submodule update (--no-recurse-submodules)

  • :no_sparse_checkout (Boolean, nil) — default: nil

    disable sparse checkout support even if core.sparseCheckout is true

  • :empty (Boolean, nil) — default: nil

    empty the index instead of reading tree object(s)

  • :quiet (Boolean, nil) — default: nil

    suppress feedback messages

    Alias: :q

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/read_tree.rb', line 70