Class: Git::Commands::Am::Apply Private
- 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.
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
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
Apply patches with sign-off
am.call('patches.mbox', signoff: true, chdir: repo.workdir)
Apply with 3-way merge fallback
Apply with 3-way merge fallback
am.call('patches.mbox', three_way: true, chdir: repo.workdir)
See Also:
Instance Method Summary collapse
-
#call(*mbox, **options) ⇒ Git::CommandLineResult
Apply patches from one or more mailbox files to the current branch.
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::CommandLineResult
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
—
pass -k flag to git-mailinfo, preserving the Subject line intact
Alias:
:k -
:keep_non_patch
(Boolean, nil)
— default:
nil
—
pass -b flag to git-mailinfo
-
: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
—
pass -m flag to git-mailinfo, adding the Message-ID header to the commit message (
--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)
— default:
nil
—
ensure at least
<n>lines of surrounding context match when applying (-C<n>)Passed to git-apply.
-
:p
(Integer)
— default:
nil
—
strip
<n>leading path components from file names (-p<n>)Passed to git-apply.
-
:directory
(String)
— default:
nil
—
prepend
<dir>to all filenamesPassed to git-apply.
-
:exclude
(Array<String>)
— default:
nil
—
skip files matching the given path pattern
May be repeated. Passed to git-apply.
-
:include
(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
*.rejfiles instead of abortingPassed 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
trueto 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:
-
(Git::CommandLineResult)
—
the result of calling
git am
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits with a non-zero exit status
|
|
# File 'lib/git/commands/am/apply.rb', line 87
|