{"thread":{"id":"6725","subject":"[PATCH] add -C[NUM] to git-am","startedAt":"2007-02-07T20:15:11Z","lastAt":"2007-02-08T23:04:25Z","messageCount":11,"participants":["Michael S. Tsirkin","Junio C Hamano","Johannes Schindelin","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"33840","messageId":"20070207201511.GF12140@mellanox.co.il","threadId":"6725","inReplyTo":null,"subject":"[PATCH] add -C[NUM] to git-am","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2007-02-07T20:15:11Z","receivedAt":"2007-02-07T20:15:11Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"\nAdd -C[NUM] to git-am so that patches can be applied even\nif context has changed a bit.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\n---\n\nI just had to apply a largish number of patches on a project\nthat has evolved since, and I found the following to be useful.\n\nWhat do others think.\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex aa4ce1d..f7d551e 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -64,6 +64,10 @@ default.   You could use `--no-utf8` to override this.\n \tThis flag is passed to the `git-apply` program that applies\n \tthe patch.\n \n+-C<n>::\n+\tThis flag is passed to the `git-apply` program that applies\n+\tthe patch.\n+\n --interactive::\n \tRun interactively, just like git-applymbox.\n \ndiff --git a/git-am.sh b/git-am.sh\nindex 1252f26..9a61234 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005, 2006 Junio C Hamano\n \n USAGE='[--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]\n-  [--interactive] [--whitespace=<option>] <mbox>...\n+  [--interactive] [--whitespace=<option>] [-CNUM] <mbox>...\n   or, when resuming [--skip | --resolved]'\n . git-sh-setup\n set_reflog_action am\n@@ -106,7 +106,8 @@ It does not apply to blobs recorded in its index.\"\n }\n \n prec=4\n-dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= ws= resolvemsg=\n+dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= resolvemsg=\n+git_apply_opt=\n \n while case \"$#\" in 0) break;; esac\n do\n@@ -142,7 +143,10 @@ do\n \tskip=t; shift ;;\n \n \t--whitespace=*)\n-\tws=$1; shift ;;\n+\tgit_apply_opt=\"$git_apply_opt $1\"; shift ;;\n+\n+\t-C*)\n+\tgit_apply_opt=\"$git_apply_opt $1\"; shift ;;\n \n \t--resolvemsg=*)\n \tresolvemsg=$(echo \"$1\" | sed -e \"s/^--resolvemsg=//\"); shift ;;\n@@ -394,7 +398,7 @@ do\n \n \tcase \"$resolved\" in\n \t'')\n-\t\tgit-apply $binary --index $ws \"$dotest/patch\"\n+\t\tgit-apply $git_apply_opt $binary --index \"$dotest/patch\"\n \t\tapply_status=$?\n \t\t;;\n \tt)\n\n-- \nMST\n"},{"id":"33842","messageId":"7vejp17m3t.fsf@assigned-by-dhcp.cox.net","threadId":"6725","inReplyTo":"20070207201511.GF12140@mellanox.co.il","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-07T20:23:50Z","receivedAt":"2007-02-07T20:23:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> Add -C[NUM] to git-am so that patches can be applied even\n> if context has changed a bit.\n>\n> Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n>\n> ---\n>\n> I just had to apply a largish number of patches on a project\n> that has evolved since, and I found the following to be useful.\n>\n> What do others think.\n\nFWIW, I am in favor although I do not foresee myself ever using\nit.  However, this has slight ramifications.\n\n - we will be keeping applymbox after all.  shouldn't this be\n   side-ported to it?\n\n - am is used as a workhorse for rebase.  shouldn't this be\n   accessible through its command line as well?\n\nThe same goes for Andy's --patchdepth thing.\n"},{"id":"33852","messageId":"20070207211910.GK12140@mellanox.co.il","threadId":"6725","inReplyTo":"7vejp17m3t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2007-02-07T21:19:10Z","receivedAt":"2007-02-07T21:19:10Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"> Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] add -C[NUM] to git-am\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > Add -C[NUM] to git-am so that patches can be applied even\n> > if context has changed a bit.\n> >\n> > Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n> >\n> > ---\n> >\n> > I just had to apply a largish number of patches on a project\n> > that has evolved since, and I found the following to be useful.\n> >\n> > What do others think.\n> \n> FWIW, I am in favor although I do not foresee myself ever using\n> it.  However, this has slight ramifications.\n> \n>  - we will be keeping applymbox after all.  shouldn't this be\n>    side-ported to it?\n\nOK.\n\n>  - am is used as a workhorse for rebase.  shouldn't this be\n>    accessible through its command line as well?\n\nHow will it be used?\n\n-- \nMST\n"},{"id":"33884","messageId":"Pine.LNX.4.63.0702080049330.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6725","inReplyTo":"7vejp17m3t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-07T23:50:08Z","receivedAt":"2007-02-07T23:50:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n\n>  - we will be keeping applymbox after all.\n\nWhy? Does -am not do strictly more than applymbox?\n\nCiao,\nDscho\n"},{"id":"33890","messageId":"eqdos9$4up$2@sea.gmane.org","threadId":"6725","inReplyTo":"Pine.LNX.4.63.0702080049330.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-07T23:54:51Z","receivedAt":"2007-02-07T23:54:51Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrote:\n> On Wed, 7 Feb 2007, Junio C Hamano wrote:\n> \n>>  - we will be keeping applymbox after all.\n> \n> Why? Does -am not do strictly more than applymbox?\n\n>From documentation, it looks like applymbox can get signoff from a file,\nand am not.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33892","messageId":"Pine.LNX.4.63.0702080106200.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6725","inReplyTo":"eqdos9$4up$2@sea.gmane.org","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-08T00:07:13Z","receivedAt":"2007-02-08T00:07:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n[please Cc me when replying]\n\nOn Thu, 8 Feb 2007, Jakub Narebski wrote:\n\n> Johannes Schindelin wrote:\n> > On Wed, 7 Feb 2007, Junio C Hamano wrote:\n> > \n> >>  - we will be keeping applymbox after all.\n> > \n> > Why? Does -am not do strictly more than applymbox?\n> \n> From documentation, it looks like applymbox can get signoff from a file, \n> and am not.\n\nSeems like just another low-hanging fruit. But I cannot believe that this \nis the only reason to keep applymbox.\n\nCiao,\nDscho\n"},{"id":"33895","messageId":"7vejp14i4u.fsf@assigned-by-dhcp.cox.net","threadId":"6725","inReplyTo":"Pine.LNX.4.63.0702080106200.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T00:17:53Z","receivedAt":"2007-02-08T00:17:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> [please Cc me when replying]\n>\n> On Thu, 8 Feb 2007, Jakub Narebski wrote:\n>\n>> From documentation, it looks like applymbox can get signoff from a file, \n>> and am not.\n>\n> Seems like just another low-hanging fruit. But I cannot believe that this \n> is the only reason to keep applymbox.\n\nI do not think <signoff> from file is of any practical use.  You\ncannot feed your committer information to match from the same\nfile anyway.\n"},{"id":"33919","messageId":"7vfy9h13yu.fsf@assigned-by-dhcp.cox.net","threadId":"6725","inReplyTo":"20070207211910.GK12140@mellanox.co.il","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T07:52:09Z","receivedAt":"2007-02-08T07:52:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n>> Quoting r. Junio C Hamano <junkio@cox.net>:\n>> \n>> FWIW, I am in favor although I do not foresee myself ever using\n>> it.  However, this has slight ramifications.\n>> \n>>  - we will be keeping applymbox after all.  shouldn't this be\n>>    side-ported to it?\n>\n> OK.\n>\n>>  - am is used as a workhorse for rebase.  shouldn't this be\n>>    accessible through its command line as well?\n>\n> How will it be used?\n\nAlthough I do not foresee myself using -C<num> that applies to\nthe whole series inexactly for \"git am\" to begin with, I would\nimagine somebody who wants to say \"git am -C1\" may want to say\nsomething like \"git rebase -C1 origin/master\",\n"},{"id":"33929","messageId":"eqena5$fb5$2@sea.gmane.org","threadId":"6725","inReplyTo":"7vfy9h13yu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-08T08:35:48Z","receivedAt":"2007-02-08T08:35:48Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n>>> Quoting r. Junio C Hamano <junkio@cox.net>:\n>>> \n>>> FWIW, I am in favor although I do not foresee myself ever using\n>>> it.  However, this has slight ramifications.\n>>> \n>>>  - we will be keeping applymbox after all.  shouldn't this be\n>>>    side-ported to it?\n>>\n>> OK.\n>>\n>>>  - am is used as a workhorse for rebase.  shouldn't this be\n>>>    accessible through its command line as well?\n>>\n>> How will it be used?\n> \n> Although I do not foresee myself using -C<num> that applies to\n> the whole series inexactly for \"git am\" to begin with, I would\n> imagine somebody who wants to say \"git am -C1\" may want to say\n> something like \"git rebase -C1 origin/master\",\n\nWhat about \"git rebase --merge\"? \n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33938","messageId":"20070208135708.GD20183@mellanox.co.il","threadId":"6725","inReplyTo":"7vfy9h13yu.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2007-02-08T13:57:08Z","receivedAt":"2007-02-08T13:57:08Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"> Quoting Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] add -C[NUM] to git-am\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> >> Quoting r. Junio C Hamano <junkio@cox.net>:\n> >> \n> >> FWIW, I am in favor although I do not foresee myself ever using\n> >> it.  However, this has slight ramifications.\n> >> \n> >>  - we will be keeping applymbox after all.  shouldn't this be\n> >>    side-ported to it?\n> >\n> > OK.\n\nWait, this can't be done - git-applymbox uses git-applypatch\ninternally and that does not get -CNUM.\nSo this will have to stay a git-am only option.\n\n> >>  - am is used as a workhorse for rebase.  shouldn't this be\n> >>    accessible through its command line as well?\n> >\n> > How will it be used?\n> \n> Although I do not foresee myself using -C<num> that applies to\n> the whole series inexactly for \"git am\" to begin with, I would\n> imagine somebody who wants to say \"git am -C1\" may want to say\n> something like \"git rebase -C1 origin/master\",\n\nLike this then?\nBTW, Junio, why is it that git-rebase calls \"git am\" and not \"git-am\"?\nThis wastes some cycles, does it not?\n\n\nAdd -C[NUM] to git-am and git-rebase so that patches can be applied even\nif context has changed a bit.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\n---\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex aa4ce1d..f7d551e 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -64,6 +64,10 @@ default.   You could use `--no-utf8` to override this.\n \tThis flag is passed to the `git-apply` program that applies\n \tthe patch.\n \n+-C<n>::\n+\tThis flag is passed to the `git-apply` program that applies\n+\tthe patch.\n+\n --interactive::\n \tRun interactively, just like git-applymbox.\n \ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 977f661..3dff2df 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -7,7 +7,7 @@ git-rebase - Forward-port local commits to the updated upstream head\n \n SYNOPSIS\n --------\n-'git-rebase' [-v] [--merge] [--onto <newbase>] <upstream> [<branch>]\n+'git-rebase' [-v] [--merge] [-CNUM] [--onto <newbase>] <upstream> [<branch>]\n \n 'git-rebase' --continue | --skip | --abort\n \n@@ -196,6 +196,12 @@ OPTIONS\n -v, \\--verbose::\n \tDisplay a diffstat of what changed upstream since the last rebase.\n \n+-C<n>::\n+\tEnsure at least <n> lines of surrounding context match before\n+\tand after each change.  When fewer lines of surrounding\n+\tcontext exist they all must match.  By default no context is\n+\tever ignored.\n+\n include::merge-strategies.txt[]\n \n NOTES\ndiff --git a/git-am.sh b/git-am.sh\nindex 1252f26..9a61234 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005, 2006 Junio C Hamano\n \n USAGE='[--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]\n-  [--interactive] [--whitespace=<option>] <mbox>...\n+  [--interactive] [--whitespace=<option>] [-CNUM] <mbox>...\n   or, when resuming [--skip | --resolved]'\n . git-sh-setup\n set_reflog_action am\n@@ -106,7 +106,8 @@ It does not apply to blobs recorded in its index.\"\n }\n \n prec=4\n-dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= ws= resolvemsg=\n+dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= resolvemsg=\n+git_apply_opt=\n \n while case \"$#\" in 0) break;; esac\n do\n@@ -142,7 +143,10 @@ do\n \tskip=t; shift ;;\n \n \t--whitespace=*)\n-\tws=$1; shift ;;\n+\tgit_apply_opt=\"$git_apply_opt $1\"; shift ;;\n+\n+\t-C*)\n+\tgit_apply_opt=\"$git_apply_opt $1\"; shift ;;\n \n \t--resolvemsg=*)\n \tresolvemsg=$(echo \"$1\" | sed -e \"s/^--resolvemsg=//\"); shift ;;\n@@ -394,7 +398,7 @@ do\n \n \tcase \"$resolved\" in\n \t'')\n-\t\tgit-apply $binary --index $ws \"$dotest/patch\"\n+\t\tgit-apply $git_apply_opt $binary --index \"$dotest/patch\"\n \t\tapply_status=$?\n \t\t;;\n \tt)\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 9d2f71d..b51d19d 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -45,6 +45,7 @@ do_merge=\n dotest=$GIT_DIR/.dotest-merge\n prec=4\n verbose=\n+git_am_opt=\n \n continue_merge () {\n \ttest -n \"$prev_head\" || die \"prev_head must be defined\"\n@@ -213,6 +214,10 @@ do\n \t-v|--verbose)\n \t\tverbose=t\n \t\t;;\n+\t-C*)\n+\t\tgit_am_opt=$1\n+\t\tshift\n+\t\t;;\n \t-*)\n \t\tusage\n \t\t;;\n@@ -322,7 +327,7 @@ fi\n if test -z \"$do_merge\"\n then\n \tgit-format-patch -k --stdout --full-index --ignore-if-in-upstream \"$upstream\"..ORIG_HEAD |\n-\tgit am --binary -3 -k --resolvemsg=\"$RESOLVEMSG\"\n+\tgit am $git_am_opt --binary -3 -k --resolvemsg=\"$RESOLVEMSG\"\n \texit $?\n fi\n \n\t\n-- \nMST\n"},{"id":"33996","messageId":"7v3b5gxnd2.fsf@assigned-by-dhcp.cox.net","threadId":"6725","inReplyTo":"20070208135708.GD20183@mellanox.co.il","subject":"Re: [PATCH] add -C[NUM] to git-am","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T23:04:25Z","receivedAt":"2007-02-08T23:04:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> BTW, Junio, why is it that git-rebase calls \"git am\" and not \"git-am\"?\n\nNot commenting on the patch itself yet in this message, but a\nquick note on the above point.\n\nAt some point after 1.5.0 we might want to audit the scripts and\nmake sure we can still run with $(gitexecdir) set to somewhere\noutside of the end user's $PATH.\n\nIn such a setting, an end user would start \"git rebase\" (or\nwhatever git program) because \"git-rebase\" will not be on her\n$PATH.  The git wrapper would do the GIT_EXEC_PATH magic before\ninvoking \"git-rebase\", so even the call to \"am\" is made in\n\"git-am\" form from our script, it will work correctly.\n\nSo in that sense, they are equivalent and does not matter from\ncorrectness point of view. It used to matter cycle-wise because\nthe \"git potty\" was a shell script, but I do not think it\nmatters anymore.\n\nOnce we make sure we still correctly support $(gitexecdir) that\nis different from $(bindir), we may want to update all the\ninvocation of \"git foo\" our scripts make to \"git-foo\", for a\ndifferent reason.\n\nOnce in-tree scripts and commands that invoke git stuff always\nwith git-foo syntax, I think we _could_ allow aliasing built-in\ncommand with something else.  For example, we could allow\n\"[alias] foo = git-foo --my-favorite-flag\" in the configuration\nfile and let the user say \"git foo\" from the command line to\nmean \"$GIT_EXEC_PATH/git-foo --my-favorite-flag\", while not\naffecting the uses of \"git-foo\" in *our* scripts.\n\nI do not think we would want to change the default to use\nseparate bindir and gitexecdir, but the intent has always been\nthat we should make it easier to do if some distro wanted to \npackage with gitexecdir set to /usr/libexec/git.\n"}]}