{"thread":{"id":"25585","subject":"[PATCH] git-am: create a config setting for reject control.","startedAt":"2010-10-29T01:27:30Z","lastAt":"2010-10-29T16:20:49Z","messageCount":3,"participants":["Paul Gortmaker","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"154710","messageId":"1288315650-2488-1-git-send-email-paul.gortmaker@windriver.com","threadId":"25585","inReplyTo":null,"subject":"[PATCH] git-am: create a config setting for reject control.","fromName":"Paul Gortmaker","fromEmail":"paul.gortmaker@windriver.com","sentAt":"2010-10-29T01:27:30Z","receivedAt":"2010-10-29T01:27:30Z","isPatch":true,"sender":{"key":"paul.gortmaker@windriver.com","avatar":null},"body":"git am already accepts a \"--reject\" switch, which basically means\napply the bits you can, but you can't set it as enabled by default\ncurrently.  This adds a config option for it, and a --no-reject\nso that you can manually override it.  The implementation copies\nfrom the one and only existing git-am config option -- \"keepcr\".\n\nSigned-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>\n---\n Documentation/git-am.txt |   12 +++++++++---\n git-am.sh                |   19 +++++++++++++++++--\n 2 files changed, 26 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 51297d0..5158e20 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -13,8 +13,8 @@ SYNOPSIS\n \t [--3way] [--interactive] [--committer-date-is-author-date]\n \t [--ignore-date] [--ignore-space-change | --ignore-whitespace]\n \t [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]\n-\t [--reject] [-q | --quiet] [--scissors | --no-scissors]\n-\t [(<mbox> | <Maildir>)...]\n+\t [--reject | --no-reject] [-q | --quiet]\n+\t [--scissors | --no-scissors] [(<mbox> | <Maildir>)...]\n 'git am' (--continue | --skip | --abort)\n \n DESCRIPTION\n@@ -87,11 +87,17 @@ default.   You can use `--no-utf8` to override this.\n -C<n>::\n -p<n>::\n --directory=<dir>::\n---reject::\n \tThese flags are passed to the 'git apply' (see linkgit:git-apply[1])\n \tprogram that applies\n \tthe patch.\n \n+--reject::\n+--no-reject::\n+\tWith `--reject`, call 'git apply' (see linkgit:git-apply[1]) with\n+\tthe same option, to have it apply whatever parts of the commit it\n+\tcan. `am.reject` configuration variable can be used to specify the\n+\tdefault behaviour.  `--no-reject` is useful to override `am.reject`.\n+\n -i::\n --interactive::\n \tRun interactively.\ndiff --git a/git-am.sh b/git-am.sh\nindex df09b42..43a510f 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -26,6 +26,7 @@ C=              pass it through git-apply\n p=              pass it through git-apply\n patch-format=   format the patch(es) are in\n reject          pass it through git-apply\n+no-reject       do not pass it through git-apply, independent of am.reject\n resolvemsg=     override error message when patch failure occurs\n continue        continue applying patches after resolving a conflict\n r,resolved      synonyms for --continue\n@@ -295,7 +296,7 @@ split_patches () {\n prec=4\n dotest=\"$GIT_DIR/rebase-apply\"\n sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=\n-resolvemsg= resume= scissors= no_inbody_headers=\n+resolvemsg= resume= scissors= no_inbody_headers= reject=\n git_apply_opt=\n committer_date_is_author_date=\n ignore_date=\n@@ -306,6 +307,11 @@ then\n     keepcr=t\n fi\n \n+if test \"$(git config --bool --get am.reject)\" = true\n+then\n+    reject=t\n+fi\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -346,8 +352,12 @@ do\n \t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1$2\")\"; shift ;;\n \t--patch-format)\n \t\tshift ; patch_format=\"$1\" ;;\n-\t--reject|--ignore-whitespace|--ignore-space-change)\n+\t--ignore-whitespace|--ignore-space-change)\n \t\tgit_apply_opt=\"$git_apply_opt $1\" ;;\n+\t--reject)\n+\t\treject=t ;;\n+\t--no-reject)\n+\t\treject=f ;;\n \t--committer-date-is-author-date)\n \t\tcommitter_date_is_author_date=t ;;\n \t--ignore-date)\n@@ -368,6 +378,11 @@ do\n \tshift\n done\n \n+if test \"$reject\" = t\n+then\n+\tgit_apply_opt=\"$git_apply_opt --reject\"\n+fi\n+\n # If the dotest directory exists, but we have finished applying all the\n # patches in them, clear it out.\n if test -d \"$dotest\" &&\n-- \n1.7.3.2.146.g2d444\n"},{"id":"154713","messageId":"20101029021148.GC28984@burratino","threadId":"25585","inReplyTo":"1288315650-2488-1-git-send-email-paul.gortmaker@windriver.com","subject":"Re: [PATCH] git-am: create a config setting for reject control.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-10-29T02:11:48Z","receivedAt":"2010-10-29T02:11:48Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Paul Gortmaker wrote:\n\n>             This adds a config option for it, and a --no-reject\n> so that you can manually override it.\n\nDocumentation?  (to put in Documentation/config.txt)  A test or two\nwould be nice, too --- see 6d8d8e0d for example.\n\n[...]\n> +++ b/git-am.sh\n> @@ -306,6 +307,11 @@ then\n>      keepcr=t\n>  fi\n>  \n> +if test \"$(git config --bool --get am.reject)\" = true\n> +then\n> +    reject=t\n> +fi\n\nSomething like the following is tempting, but I suspect \"git rebase\"\nalready copes.  Another potential test. :)\n\nHope that helps.\nJonathan\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 43a510f..b9fdb5a 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -307,10 +307,7 @@ then\n     keepcr=t\n fi\n \n-if test \"$(git config --bool --get am.reject)\" = true\n-then\n-    reject=t\n-fi\n+reject=config\n \n while test $# != 0\n do\n@@ -378,6 +375,17 @@ do\n \tshift\n done\n \n+if test \"$reject\" = config\n+then\n+\tif test \"$rebasing\" != t &&\n+\t   \"$(git config --bool --get am.reject)\" = true\n+\tthen\n+\t\treject=t\n+\telse\n+\t\treject=\n+\tfi\n+fi\n+\n if test \"$reject\" = t\n then\n \tgit_apply_opt=\"$git_apply_opt --reject\"\n"},{"id":"154789","messageId":"7vlj5h6kda.fsf@alter.siamese.dyndns.org","threadId":"25585","inReplyTo":"1288315650-2488-1-git-send-email-paul.gortmaker@windriver.com","subject":"Re: [PATCH] git-am: create a config setting for reject control.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-29T16:20:49Z","receivedAt":"2010-10-29T16:20:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Gortmaker <paul.gortmaker@windriver.com> writes:\n\n> git am already accepts a \"--reject\" switch, which basically means\n> apply the bits you can, but you can't set it as enabled by default\n> currently.\n\nDoes this work correctly with all four combinations of (have/do not have)\nconfig, (have/do not have) command line option, when \"am\" stops in the\nmiddle due to conflict and you say \"git am --continue\" after dealing with\nthe first such conflict?  The first choice needs to be remembered and\nused.\n"}]}