* [PATCH] git-am: create a config setting for reject control.
@ 2010-10-29 1:27 Paul Gortmaker
2010-10-29 2:11 ` Jonathan Nieder
2010-10-29 16:20 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Paul Gortmaker @ 2010-10-29 1:27 UTC (permalink / raw)
To: git
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-am: create a config setting for reject control.
2010-10-29 1:27 [PATCH] git-am: create a config setting for reject control Paul Gortmaker
@ 2010-10-29 2:11 ` Jonathan Nieder
2010-10-29 16:20 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Nieder @ 2010-10-29 2:11 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: git
Paul Gortmaker wrote:
> This adds a config option for it, and a --no-reject
> so that you can manually override it.
Documentation? (to put in Documentation/config.txt) A test or two
would be nice, too --- see 6d8d8e0d for example.
[...]
> +++ b/git-am.sh
> @@ -306,6 +307,11 @@ then
> keepcr=t
> fi
>
> +if test "$(git config --bool --get am.reject)" = true
> +then
> + reject=t
> +fi
Something like the following is tempting, but I suspect "git rebase"
already copes. Another potential test. :)
Hope that helps.
Jonathan
diff --git a/git-am.sh b/git-am.sh
index 43a510f..b9fdb5a 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -307,10 +307,7 @@ then
keepcr=t
fi
-if test "$(git config --bool --get am.reject)" = true
-then
- reject=t
-fi
+reject=config
while test $# != 0
do
@@ -378,6 +375,17 @@ do
shift
done
+if test "$reject" = config
+then
+ if test "$rebasing" != t &&
+ "$(git config --bool --get am.reject)" = true
+ then
+ reject=t
+ else
+ reject=
+ fi
+fi
+
if test "$reject" = t
then
git_apply_opt="$git_apply_opt --reject"
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-am: create a config setting for reject control.
2010-10-29 1:27 [PATCH] git-am: create a config setting for reject control Paul Gortmaker
2010-10-29 2:11 ` Jonathan Nieder
@ 2010-10-29 16:20 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-10-29 16:20 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: git
Paul Gortmaker <paul.gortmaker@windriver.com> writes:
> 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.
Does this work correctly with all four combinations of (have/do not have)
config, (have/do not have) command line option, when "am" stops in the
middle due to conflict and you say "git am --continue" after dealing with
the first such conflict? The first choice needs to be remembered and
used.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-29 16:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29 1:27 [PATCH] git-am: create a config setting for reject control Paul Gortmaker
2010-10-29 2:11 ` Jonathan Nieder
2010-10-29 16:20 ` Junio C Hamano
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).