From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: git@vger.kernel.org
Subject: [PATCH] git-am: create a config setting for reject control.
Date: Thu, 28 Oct 2010 21:27:30 -0400 [thread overview]
Message-ID: <1288315650-2488-1-git-send-email-paul.gortmaker@windriver.com> (raw)
git am already accepts a "--reject" switch, which basically means
apply the bits you can, but you can't set it as enabled by default
currently. This adds a config option for it, and a --no-reject
so that you can manually override it. The implementation copies
from the one and only existing git-am config option -- "keepcr".
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
Documentation/git-am.txt | 12 +++++++++---
git-am.sh | 19 +++++++++++++++++--
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 51297d0..5158e20 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -13,8 +13,8 @@ SYNOPSIS
[--3way] [--interactive] [--committer-date-is-author-date]
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
- [--reject] [-q | --quiet] [--scissors | --no-scissors]
- [(<mbox> | <Maildir>)...]
+ [--reject | --no-reject] [-q | --quiet]
+ [--scissors | --no-scissors] [(<mbox> | <Maildir>)...]
'git am' (--continue | --skip | --abort)
DESCRIPTION
@@ -87,11 +87,17 @@ default. You can use `--no-utf8` to override this.
-C<n>::
-p<n>::
--directory=<dir>::
---reject::
These flags are passed to the 'git apply' (see linkgit:git-apply[1])
program that applies
the patch.
+--reject::
+--no-reject::
+ With `--reject`, call 'git apply' (see linkgit:git-apply[1]) with
+ the same option, to have it apply whatever parts of the commit it
+ can. `am.reject` configuration variable can be used to specify the
+ default behaviour. `--no-reject` is useful to override `am.reject`.
+
-i::
--interactive::
Run interactively.
diff --git a/git-am.sh b/git-am.sh
index df09b42..43a510f 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -26,6 +26,7 @@ C= pass it through git-apply
p= pass it through git-apply
patch-format= format the patch(es) are in
reject pass it through git-apply
+no-reject do not pass it through git-apply, independent of am.reject
resolvemsg= override error message when patch failure occurs
continue continue applying patches after resolving a conflict
r,resolved synonyms for --continue
@@ -295,7 +296,7 @@ split_patches () {
prec=4
dotest="$GIT_DIR/rebase-apply"
sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=
-resolvemsg= resume= scissors= no_inbody_headers=
+resolvemsg= resume= scissors= no_inbody_headers= reject=
git_apply_opt=
committer_date_is_author_date=
ignore_date=
@@ -306,6 +307,11 @@ then
keepcr=t
fi
+if test "$(git config --bool --get am.reject)" = true
+then
+ reject=t
+fi
+
while test $# != 0
do
case "$1" in
@@ -346,8 +352,12 @@ do
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
--patch-format)
shift ; patch_format="$1" ;;
- --reject|--ignore-whitespace|--ignore-space-change)
+ --ignore-whitespace|--ignore-space-change)
git_apply_opt="$git_apply_opt $1" ;;
+ --reject)
+ reject=t ;;
+ --no-reject)
+ reject=f ;;
--committer-date-is-author-date)
committer_date_is_author_date=t ;;
--ignore-date)
@@ -368,6 +378,11 @@ do
shift
done
+if test "$reject" = t
+then
+ git_apply_opt="$git_apply_opt --reject"
+fi
+
# If the dotest directory exists, but we have finished applying all the
# patches in them, clear it out.
if test -d "$dotest" &&
--
1.7.3.2.146.g2d444
next reply other threads:[~2010-10-29 1:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 1:27 Paul Gortmaker [this message]
2010-10-29 2:11 ` [PATCH] git-am: create a config setting for reject control Jonathan Nieder
2010-10-29 16:20 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288315650-2488-1-git-send-email-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).