{"thread":{"id":"39493","subject":"[PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests","startedAt":"2015-06-02T13:24:31Z","lastAt":"2015-06-02T14:37:13Z","messageCount":8,"participants":["Remi Lespinet","Matthieu Moy","Remi LESPINET","Mikael Magnusson","Eric Sunshine","Paul Tan"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"262709","messageId":"1433251472-29460-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39493","inReplyTo":null,"subject":"[PATCH/RFC v2 1/2] t4150-am: refactor am -3 tests","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-02T13:24:31Z","receivedAt":"2015-06-02T13:24:31Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Create a setup for git am -3 in a separate test instead of creating\nthis setup each time.\n\nThis prepares for the next commit which will use this setup as well.\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\nI removed the function creating temporary branch for now, because this\nwould have cost too much time reviewing. I've just done a refactoring\nto simplify changes introduced in the next commit.\n\n t/t4150-am.sh | 32 ++++++++++++++------------------\n 1 file changed, 14 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 306e6f3..6ced98c 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -274,15 +274,21 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '\n \tgrep \"^\\[foo\\] third\" actual\n '\n \n+test_expect_success 'setup am -3' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout -b base3way master2 &&\n+\tsed -n -e \"3,\\$p\" msg >file &&\n+\thead -n 9 msg >>file &&\n+\tgit add file &&\n+\ttest_tick &&\n+\tgit commit -m \"copied stuff\"\n+'\n+\n test_expect_success 'am -3 falls back to 3-way merge' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-\tgit checkout -b lorem2 master2 &&\n-\tsed -n -e \"3,\\$p\" msg >file &&\n-\thead -n 9 msg >>file &&\n-\tgit add file &&\n-\ttest_tick &&\n-\tgit commit -m \"copied stuff\" &&\n+\tgit checkout -b lorem2 base3way &&\n \tgit am -3 lorem-move.patch &&\n \ttest_path_is_missing .git/rebase-apply &&\n \tgit diff --exit-code lorem\n@@ -291,12 +297,7 @@ test_expect_success 'am -3 falls back to 3-way merge' '\n test_expect_success 'am -3 -p0 can read --no-prefix patch' '\n \trm -fr .git/rebase-apply &&\n \tgit reset --hard &&\n-\tgit checkout -b lorem3 master2 &&\n-\tsed -n -e \"3,\\$p\" msg >file &&\n-\thead -n 9 msg >>file &&\n-\tgit add file &&\n-\ttest_tick &&\n-\tgit commit -m \"copied stuff\" &&\n+\tgit checkout -b lorem3 base3way &&\n \tgit am -3 -p0 lorem-zero.patch &&\n \ttest_path_is_missing .git/rebase-apply &&\n \tgit diff --exit-code lorem\n@@ -338,12 +339,7 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge'\n test_expect_success 'am -3 -q is quiet' '\n \trm -fr .git/rebase-apply &&\n \tgit checkout -f lorem2 &&\n-\tgit reset master2 --hard &&\n-\tsed -n -e \"3,\\$p\" msg >file &&\n-\thead -n 9 msg >>file &&\n-\tgit add file &&\n-\ttest_tick &&\n-\tgit commit -m \"copied stuff\" &&\n+\tgit reset base3way --hard &&\n \tgit am -3 -q lorem-move.patch >output.out 2>&1 &&\n \t! test -s output.out\n '\n-- \n1.9.1\n"},{"id":"262710","messageId":"1433251472-29460-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39493","inReplyTo":"1433251472-29460-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"[PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-02T13:24:32Z","receivedAt":"2015-06-02T13:24:32Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Add the am.threeWay configuration variable to use the -3 or --3way\noption of git am by default. When am.threeway is set and not desired\nfor a specific git am command, the --no-3way option can be used to\noverride it.\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\n Documentation/config.txt |  7 +++++++\n Documentation/git-am.txt |  6 ++++--\n git-am.sh                |  7 +++++++\n t/t4150-am.sh            | 19 +++++++++++++++++++\n 4 files changed, 37 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d44bc85..8e42752 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -769,6 +769,13 @@ am.keepcr::\n \tby giving '--no-keep-cr' from the command line.\n \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n \n+am.threeWay::\n+\tIf true, git-am will fall back on 3-way merge when the patch\n+\tcannot be applied cleanly, in the same way as the '-3' or\n+\t'--3-way' option. Can be overridden by giving '--no-3-way'\n+\tfrom the command line.\n+\tSee linkgit:git-am[1].\n+\n apply.ignoreWhitespace::\n \tWhen set to 'change', tells 'git apply' to ignore changes in\n \twhitespace, in the same way as the '--ignore-space-change'\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 0d8ba48..3190c05 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -89,11 +89,13 @@ default.   You can use `--no-utf8` to override this.\n \tlinkgit:git-mailinfo[1]).\n \n -3::\n---3way::\n+--[no-]3way::\n \tWhen the patch does not apply cleanly, fall back on\n \t3-way merge if the patch records the identity of blobs\n \tit is supposed to apply to and we have those blobs\n-\tavailable locally.\n+\tavailable locally.  `am.threeWay` configuration variable\n+\tcan be used to specify the default behaviour.  `--no-3way`\n+\tis useful to override `am.threeWay`.\n \n --ignore-space-change::\n --ignore-whitespace::\ndiff --git a/git-am.sh b/git-am.sh\nindex 761befb..781507c 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -389,6 +389,11 @@ then\n     keepcr=t\n fi\n \n+if test \"$(git config --bool --get am.threeWay)\" = true\n+then\n+    threeway=t\n+fi\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -400,6 +405,8 @@ it will be removed. Please do not use it anymore.\"\n \t\t;;\n \t-3|--3way)\n \t\tthreeway=t ;;\n+\t--no-3way)\n+\t\tthreeway=f ;;\n \t-s|--signoff)\n \t\tsign=t ;;\n \t-u|--utf8)\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 6ced98c..b822a39 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -303,6 +303,25 @@ test_expect_success 'am -3 -p0 can read --no-prefix patch' '\n \tgit diff --exit-code lorem\n '\n \n+test_expect_success 'am with config am.threeWay falls back to 3-way merge' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout -b lorem4 base3way &&\n+\ttest_config am.threeWay 1 &&\n+\tgit am lorem-move.patch &&\n+\ttest_path_is_missing .git/rebase-apply &&\n+\tgit diff --exit-code lorem\n+'\n+\n+test_expect_success 'am with config am.threeWay overridden by --no-3way' '\n+\trm -fr .git/rebase-apply &&\n+\tgit reset --hard &&\n+\tgit checkout -b lorem5 base3way &&\n+\ttest_config am.threeWay 1 &&\n+\ttest_must_fail git am --no-3way lorem-move.patch &&\n+\ttest_path_is_dir .git/rebase-apply\n+'\n+\n test_expect_success 'am can rename a file' '\n \tgrep \"^rename from\" rename.patch &&\n \trm -fr .git/rebase-apply &&\n-- \n1.9.1\n"},{"id":"262713","messageId":"vpqvbf6jko8.fsf@anie.imag.fr","threadId":"39493","inReplyTo":"1433251472-29460-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-02T13:37:27Z","receivedAt":"2015-06-02T13:37:27Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n\n> +if test \"$(git config --bool --get am.threeWay)\" = true\n> +then\n> +    threeway=t\n> +fi\n\nI think you missed Paul's remark on this:\n\nhttp://article.gmane.org/gmane.comp.version-control.git/270150\n\nNot terribly important since am will be rewritten soon, though.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"262716","messageId":"87vbf6tdyu.fsf@ensimag.grenoble-inp.fr","threadId":"39493","inReplyTo":"vpqvbf6jko8.fsf@anie.imag.fr","subject":"[PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Remi LESPINET","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-02T13:52:09Z","receivedAt":"2015-06-02T13:52:09Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n>\n> > +if test \"$(git config --bool --get am.threeWay)\" = true\n> > +then\n> > +    threeway=t\n> > +fi\n>\n> I think you missed Paul's remark on this:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/270150\n>\n> Not terribly important since am will be rewritten soon, though.\n\nOh right, sorry about that, I modify it and I resend the patch asap\n"},{"id":"262717","messageId":"CAHYJk3TDB-NgyvpJrBpgZRPgBJKshD0XwK9Z9g22K3nD+Fx=Rw@mail.gmail.com","threadId":"39493","inReplyTo":"1433251472-29460-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2015-06-02T13:58:18Z","receivedAt":"2015-06-02T13:58:18Z","isPatch":true,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"On Tue, Jun 2, 2015 at 3:24 PM, Remi Lespinet\n<remi.lespinet@ensimag.grenoble-inp.fr> wrote:\n> Add the am.threeWay configuration variable to use the -3 or --3way\n> option of git am by default. When am.threeway is set and not desired\n> for a specific git am command, the --no-3way option can be used to\n> override it.\n>\n> Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n> ---\n>  Documentation/config.txt |  7 +++++++\n>  Documentation/git-am.txt |  6 ++++--\n>  git-am.sh                |  7 +++++++\n>  t/t4150-am.sh            | 19 +++++++++++++++++++\n>  4 files changed, 37 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index d44bc85..8e42752 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -769,6 +769,13 @@ am.keepcr::\n>         by giving '--no-keep-cr' from the command line.\n>         See linkgit:git-am[1], linkgit:git-mailsplit[1].\n>\n> +am.threeWay::\n> +       If true, git-am will fall back on 3-way merge when the patch\n> +       cannot be applied cleanly, in the same way as the '-3' or\n> +       '--3-way' option. Can be overridden by giving '--no-3-way'\n> +       from the command line.\n> +       See linkgit:git-am[1].\n> +\n\nThis part spells it 3-way while everywhere else appears to be 3way.\n\n-- \nMikael Magnusson\n"},{"id":"262718","messageId":"CAPig+cQZCekq+7UuO8t7+xxU0SR0t42zNn10gY1B5kVeeh7buQ@mail.gmail.com","threadId":"39493","inReplyTo":"87vbf6tdyu.fsf@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-02T14:01:08Z","receivedAt":"2015-06-02T14:01:08Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jun 2, 2015 at 9:52 AM, Remi LESPINET\n<remi.lespinet@ensimag.grenoble-inp.fr> wrote:\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n>>\n>> > +if test \"$(git config --bool --get am.threeWay)\" = true\n>> > +then\n>> > +    threeway=t\n>> > +fi\n>>\n>> I think you missed Paul's remark on this:\n>>\n>> http://article.gmane.org/gmane.comp.version-control.git/270150\n>>\n>> Not terribly important since am will be rewritten soon, though.\n>\n> Oh right, sorry about that, I modify it and I resend the patch asap\n\nIn fact, it looks like all of Paul's remarks were missed. (The bit at\nthe bottom of his review is also important.)\n"},{"id":"262719","messageId":"vpqmw0ijj0m.fsf@anie.imag.fr","threadId":"39493","inReplyTo":"1433251472-29460-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-02T14:13:13Z","receivedAt":"2015-06-02T14:13:13Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n\n> Add the am.threeWay configuration variable to use the -3 or --3way\n> option of git am by default. When am.threeway is set and not desired\n> for a specific git am command, the --no-3way option can be used to\n> override it.\n>\n> Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n> ---\n>  Documentation/config.txt |  7 +++++++\n>  Documentation/git-am.txt |  6 ++++--\n>  git-am.sh                |  7 +++++++\n>  t/t4150-am.sh            | 19 +++++++++++++++++++\n>  4 files changed, 37 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index d44bc85..8e42752 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -769,6 +769,13 @@ am.keepcr::\n>  \tby giving '--no-keep-cr' from the command line.\n>  \tSee linkgit:git-am[1], linkgit:git-mailsplit[1].\n>  \n> +am.threeWay::\n> +\tIf true, git-am will fall back on 3-way merge when the patch\n\ngit-am should be spelled `git am` or 'git am' (the second is used a lot\nin git-am.txt, but Documentation/CodingGuidelines says:\n\n Literal examples (e.g. use of command-line options, command names, and\n configuration variables) are typeset in monospace, and if you can use\n `backticks around word phrases`, do so.\n   `--pretty=oneline`\n   `git rev-list`\n   `remote.pushDefault`\n) so I guess the first is the right way to typeset it.\n\nFYI, the syntax git-am actually existed in the past (before git 1.6).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"262733","messageId":"CACRoPnSZ77mOvqRn+PLauDyQtjU8gDvtUKPmUzLo6Hc4CE+RvQ@mail.gmail.com","threadId":"39493","inReplyTo":"vpqvbf6jko8.fsf@anie.imag.fr","subject":"Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-06-02T14:37:13Z","receivedAt":"2015-06-02T14:37:13Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Hi,\n\nOn Tue, Jun 2, 2015 at 9:37 PM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n>\n>> +if test \"$(git config --bool --get am.threeWay)\" = true\n>> +then\n>> +    threeway=t\n>> +fi\n>\n> I think you missed Paul's remark on this:\n>\n> http://article.gmane.org/gmane.comp.version-control.git/270150\n>\n> Not terribly important since am will be rewritten soon, though.\n\nAs the person who had to do four preparatory patch series' to fix bugs\nfor the rewrite of git-pull, I respectfully disagree ;-)\n\nRegards,\nPaul\n"}]}