Class: Git::Commands::Am::Apply Private

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

Implements git am to apply a series of patches from a mailbox

Splits mail messages in a mailbox into commit log messages, authorship information, and patches, and applies them to the current branch.

Examples:

Apply patches from a mailbox file

am = Git::Commands::Am::Apply.new(execution_context)
am.call('patches.mbox', chdir: repo.workdir)

Apply patches with sign-off

am.call('patches.mbox', signoff: true, chdir: repo.workdir)

Apply with 3-way merge fallback

am.call('patches.mbox', three_way: true, chdir: repo.workdir)

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(*mbox, **options) ⇒ Git::CommandLine::Result

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.

Apply patches from one or more mailbox files to the current branch

Parameters:

  • mbox (Array<String>)

    zero or more mailbox file paths or Maildir directories

    If omitted, reads from standard input.

  • options (Hash)

    command options

Options Hash (**options):

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

    add Signed-off-by trailer

    Alias: :s

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

    preserve the Subject line in commit messages (--keep)

    Alias: :k

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

    retain non-patch parts of the message body (--keep-non-patch)

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

    retain CR at end of lines (--keep-cr)

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

    strip CR at end of lines (--no-keep-cr)

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

    remove everything in the body before a scissors line (--scissors)

    Alias: :c

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

    disable scissors mode (--no-scissors)

  • :quoted_cr (String) — default: nil

    how to handle CR in quoted text passed to git-mailinfo

    Valid actions: 'nowarn', 'warn', 'error'.

  • :empty (String) — default: nil

    how to handle an e-mail message lacking a patch

    Valid values: 'stop' (fail, default), 'drop' (skip the message), 'keep' (create an empty commit).

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

    add the Message-ID header to commit messages (--message-id)

    Alias: :m

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

    do not add the Message-ID header (--no-message-id)

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

    be quiet; only print error messages

    Alias: :q

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

    re-code the commit log message in UTF-8 (--utf8)

    Alias: :u

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

    do not re-code the commit log message (--no-utf8)

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

    attempt 3-way merge when context does not match (--3way)

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

    disable 3-way merge fallback (--no-3way)

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

    allow rerere to update the index with auto-resolved conflicts (--rerere-autoupdate)

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

    prevent rerere from auto-updating the index (--no-rerere-autoupdate)

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

    ignore whitespace changes when applying (passed to git-apply)

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

    ignore whitespace when applying (passed to git-apply)

  • :whitespace (String) — default: nil

    whitespace error handling (e.g., 'nowarn', 'warn', 'fix', 'error')

    Passed to git-apply.

  • :C (Integer, String) — default: nil

    ensure at least <n> lines of surrounding context match when applying (-C<n>)

    Passed to git-apply.

  • :p (Integer, String) — default: nil

    strip <n> leading path components from file names (-p<n>)

    Passed to git-apply.

  • :directory (String) — default: nil

    prepend <dir> to all filenames

    Passed to git-apply.

  • :exclude (String, Array<String>) — default: nil

    skip files matching the given path pattern

    May be repeated. Passed to git-apply.

  • :include (String, Array<String>) — default: nil

    apply only to files matching the given path pattern

    May be repeated. Passed to git-apply.

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

    leave rejected hunks in *.rej files instead of aborting

    Passed to git-apply.

  • :patch_format (String) — default: nil

    override patch format detection

    Valid formats: 'mbox', 'mboxrd', 'stgit', 'stgit-series', 'hg'.

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

    run interactively, prompting before each patch is applied

    Alias: :i

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

    run pre-applypatch and applypatch-msg hooks (--verify)

    Hooks are run by default when this option is omitted.

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

    bypass pre-applypatch and applypatch-msg hooks (--no-verify)

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

    use the author date as the committer date

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

    use the committer date as the author date

  • :gpg_sign (Boolean, String, nil) — default: nil

    sign commits using GPG (--gpg-sign)

    Pass a key-ID string to select the signing key; pass true to use the committer identity. Alias: :S

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

    countermand commit.gpgSign configuration (--no-gpg-sign)

  • :chdir (String) — default: nil

    change to this directory before running git

    Not passed to the git CLI.

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



257
258
259
# File 'lib/git/commands/am/apply.rb', line 257

def call(*, **)
  super
end