git-am: create a config setting for reject control.
PATCH 1/1 git-am: create a config setting for reject control.
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".
--- Documentation/git-am.txt | 12 +++++++++--- git-am.sh | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-)
Documentation/git-am.txt +9 -3
@@ -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.
git-am.sh +17 -2
@@ -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" &&
Signature · 1 line
1.7.3.2.146.g2d444
Quoted 2 lines · Paul Gortmaker
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.
[...]
Review then · line 313
Quoted 9 lines
+++
b/git-am.sh(quoted diff) +4
-0@@ -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
git-am.sh +12 -4
@@ -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"
Quoted 3 lines · Paul Gortmaker
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.