{"thread":{"id":"54671","subject":"[PATCH] t4015: let the test pass with any default branch name","startedAt":"2020-11-18T19:26:46Z","lastAt":"2020-11-18T23:36:09Z","messageCount":4,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"410266","messageId":"pull.794.git.1605727594021.gitgitgadget@gmail.com","threadId":"54671","inReplyTo":null,"subject":"[PATCH] t4015: let the test pass with any default branch name","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-11-18T19:26:33Z","receivedAt":"2020-11-18T19:26:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe do not need to hard-code the actual branch name, as we have access to\nthe reflog and can be a lot more precise at what we want.\n\nStrangely enough, this test case would have succeeded even with an\noverridden default branch name, obviously for the wrong reason. Let's\nverify that it passes for the expected reason, by looking for a\ntell-tale in Git's output.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    t4015: let the test pass with any default branch name\n    \n    Aaaaand another issue, also found while working on \n    https://github.com/gitgitgadget/git/pull/762.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-794%2Fdscho%2Ft4015-and-default-branch-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-794/dscho/t4015-and-default-branch-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/794\n\n t/t4015-diff-whitespace.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 8bdaa0a693..c9dd62b70e 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -883,7 +883,8 @@ test_expect_success 'combined diff with autocrlf conversion' '\n \techo >x goodbye &&\n \tgit commit -m \"the other side\" x &&\n \tgit config core.autocrlf true &&\n-\ttest_must_fail git merge master &&\n+\ttest_must_fail git merge @{2} >actual &&\n+\ttest_i18ngrep \"Automatic merge failed\" actual &&\n \n \tgit diff >actual.raw &&\n \tsed -e \"1,/^@@@/d\" actual.raw >actual &&\n\nbase-commit: e31aba42fb12bdeb0f850829e008e1e3f43af500\n-- \ngitgitgadget\n"},{"id":"410270","messageId":"xmqqd00a1knr.fsf@gitster.c.googlers.com","threadId":"54671","inReplyTo":"pull.794.git.1605727594021.gitgitgadget@gmail.com","subject":"Re: [PATCH] t4015: let the test pass with any default branch name","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-18T20:20:56Z","receivedAt":"2020-11-18T20:21:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> We do not need to hard-code the actual branch name, as we have access to\n> the reflog and can be a lot more precise at what we want.\n\nI am not enthused to see us going beyond \"@{1}\" or \"@{-1}\".  It\nwould make the test a bit too brittle as a future changes need to\nrefrain from creating another commit and/or switching to a third\nbranch to do some more set-up before coming here to attempt an\nmerge.  \n\nIn this particular case, \"git merge @{-1}\" may be more robust from\nthat point of view\n\nThanks.\n\n>  t/t4015-diff-whitespace.sh | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n>\n> diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\n> index 8bdaa0a693..c9dd62b70e 100755\n> --- a/t/t4015-diff-whitespace.sh\n> +++ b/t/t4015-diff-whitespace.sh\n> @@ -883,7 +883,8 @@ test_expect_success 'combined diff with autocrlf conversion' '\n>  \techo >x goodbye &&\n>  \tgit commit -m \"the other side\" x &&\n>  \tgit config core.autocrlf true &&\n> -\ttest_must_fail git merge master &&\n> +\ttest_must_fail git merge @{2} >actual &&\n> +\ttest_i18ngrep \"Automatic merge failed\" actual &&\n>  \n>  \tgit diff >actual.raw &&\n>  \tsed -e \"1,/^@@@/d\" actual.raw >actual &&\n>\n> base-commit: e31aba42fb12bdeb0f850829e008e1e3f43af500\n"},{"id":"410281","messageId":"nycvar.QRO.7.76.6.2011190011340.56@tvgsbejvaqbjf.bet","threadId":"54671","inReplyTo":"xmqqd00a1knr.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] t4015: let the test pass with any default branch name","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-11-18T23:13:13Z","receivedAt":"2020-11-18T23:13:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Wed, 18 Nov 2020, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n>\n> > From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> >\n> > We do not need to hard-code the actual branch name, as we have access to\n> > the reflog and can be a lot more precise at what we want.\n>\n> I am not enthused to see us going beyond \"@{1}\" or \"@{-1}\".\n\nRight. It also makes it a bit harder to understand the test case for the\noccasional reader.\n\n> It would make the test a bit too brittle as a future changes need to\n> refrain from creating another commit and/or switching to a third branch\n> to do some more set-up before coming here to attempt an merge.\n>\n> In this particular case, \"git merge @{-1}\" may be more robust from\n> that point of view\n\nIt might be _slightly_ more robust, but not by a lot. I opted to use\n`test_commit` instead and then refer to the revision via the tag that is\ncreated by that function.\n\nCiao,\nDscho\n\n> > diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\n> > index 8bdaa0a693..c9dd62b70e 100755\n> > --- a/t/t4015-diff-whitespace.sh\n> > +++ b/t/t4015-diff-whitespace.sh\n> > @@ -883,7 +883,8 @@ test_expect_success 'combined diff with autocrlf conversion' '\n> >  \techo >x goodbye &&\n> >  \tgit commit -m \"the other side\" x &&\n> >  \tgit config core.autocrlf true &&\n> > -\ttest_must_fail git merge master &&\n> > +\ttest_must_fail git merge @{2} >actual &&\n> > +\ttest_i18ngrep \"Automatic merge failed\" actual &&\n> >\n> >  \tgit diff >actual.raw &&\n> >  \tsed -e \"1,/^@@@/d\" actual.raw >actual &&\n> >\n> > base-commit: e31aba42fb12bdeb0f850829e008e1e3f43af500\n>\n>\n"},{"id":"410283","messageId":"pull.794.v2.git.1605742544801.gitgitgadget@gmail.com","threadId":"54671","inReplyTo":"pull.794.git.1605727594021.gitgitgadget@gmail.com","subject":"[PATCH v2] t4015: let the test pass with any default branch name","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-11-18T23:35:44Z","receivedAt":"2020-11-18T23:36:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe do not need to hard-code the actual branch name, as we can use the\n`test_commit` function to simplify the code and use the tag it\ngenerates, thereby being a lot more precise in what we want.\n\nStrangely enough, this test case would have succeeded even with an\noverridden default branch name, obviously for the wrong reason. Let's\nverify that it passes for the expected reason, by looking for a\ntell-tale in Git's output.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    t4015: let the test pass with any default branch name\n    \n    Aaaaand another issue, also found while working on \n    https://github.com/gitgitgadget/git/pull/762.\n    \n    Changes since v1:\n    \n     * We now use test_commit and the tag it creates, rather than the\n       reflog.\n     *\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-794%2Fdscho%2Ft4015-and-default-branch-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-794/dscho/t4015-and-default-branch-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/794\n\nRange-diff vs v1:\n\n 1:  5467cae0dd ! 1:  2f6d07fe90 t4015: let the test pass with any default branch name\n     @@ Metadata\n       ## Commit message ##\n          t4015: let the test pass with any default branch name\n      \n     -    We do not need to hard-code the actual branch name, as we have access to\n     -    the reflog and can be a lot more precise at what we want.\n     +    We do not need to hard-code the actual branch name, as we can use the\n     +    `test_commit` function to simplify the code and use the tag it\n     +    generates, thereby being a lot more precise in what we want.\n      \n          Strangely enough, this test case would have succeeded even with an\n          overridden default branch name, obviously for the wrong reason. Let's\n     @@ Commit message\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## t/t4015-diff-whitespace.sh ##\n     -@@ t/t4015-diff-whitespace.sh: test_expect_success 'combined diff with autocrlf conversion' '\n     +@@ t/t4015-diff-whitespace.sh: test_expect_success 'rename empty' '\n     + test_expect_success 'combined diff with autocrlf conversion' '\n     + \n     + \tgit reset --hard &&\n     +-\techo >x hello &&\n     +-\tgit commit -m \"one side\" x &&\n     ++\ttest_commit \"one side\" x hello one-side &&\n     + \tgit checkout HEAD^ &&\n       \techo >x goodbye &&\n       \tgit commit -m \"the other side\" x &&\n       \tgit config core.autocrlf true &&\n      -\ttest_must_fail git merge master &&\n     -+\ttest_must_fail git merge @{2} >actual &&\n     ++\ttest_must_fail git merge one-side >actual &&\n      +\ttest_i18ngrep \"Automatic merge failed\" actual &&\n       \n       \tgit diff >actual.raw &&\n\n\n t/t4015-diff-whitespace.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 8bdaa0a693..47f0e2889d 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -877,13 +877,13 @@ test_expect_success 'rename empty' '\n test_expect_success 'combined diff with autocrlf conversion' '\n \n \tgit reset --hard &&\n-\techo >x hello &&\n-\tgit commit -m \"one side\" x &&\n+\ttest_commit \"one side\" x hello one-side &&\n \tgit checkout HEAD^ &&\n \techo >x goodbye &&\n \tgit commit -m \"the other side\" x &&\n \tgit config core.autocrlf true &&\n-\ttest_must_fail git merge master &&\n+\ttest_must_fail git merge one-side >actual &&\n+\ttest_i18ngrep \"Automatic merge failed\" actual &&\n \n \tgit diff >actual.raw &&\n \tsed -e \"1,/^@@@/d\" actual.raw >actual &&\n\nbase-commit: e31aba42fb12bdeb0f850829e008e1e3f43af500\n-- \ngitgitgadget\n"}]}