{"thread":{"id":"35986","subject":"[PATCH v2 1/2] t3200-branch: test setting branch as own upstream","startedAt":"2014-02-28T06:41:02Z","lastAt":"2014-03-06T21:53:49Z","messageCount":5,"participants":["Brian Gesiak","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"235542","messageId":"1393569662-68351-1-git-send-email-modocache@gmail.com","threadId":"35986","inReplyTo":null,"subject":"[PATCH v2 1/2] t3200-branch: test setting branch as own upstream","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-02-28T06:41:02Z","receivedAt":"2014-02-28T06:41:02Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"No test asserts that \"git branch -u refs/heads/my-branch my-branch\"\nemits a warning. Add a test that does so.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n t/t3200-branch.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex fcdb867..6164126 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -507,6 +507,14 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--set-upstream-to shows warning if used to set branch as own upstream' '\n+\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n+\tcat >expected <<EOF &&\n+warning: Not setting branch my13 as its own upstream.\n+EOF\n+\ttest_i18ncmp expected actual\n+'\n+\n # Keep this test last, as it changes the current branch\n cat >expect <<EOF\n $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tbranch: Created from master\n-- \n1.8.3.4 (Apple Git-47)\n"},{"id":"236056","messageId":"xmqqmwh5ikl0.fsf@gitster.dls.corp.google.com","threadId":"35986","inReplyTo":"1393569662-68351-1-git-send-email-modocache@gmail.com","subject":"Re: [PATCH v2 1/2] t3200-branch: test setting branch as own upstream","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-04T23:56:59Z","receivedAt":"2014-03-04T23:56:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brian Gesiak <modocache@gmail.com> writes:\n\n> No test asserts that \"git branch -u refs/heads/my-branch my-branch\"\n> emits a warning. Add a test that does so.\n>\n> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n> ---\n>  t/t3200-branch.sh | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n>\n> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\n> index fcdb867..6164126 100755\n> --- a/t/t3200-branch.sh\n> +++ b/t/t3200-branch.sh\n> @@ -507,6 +507,14 @@ EOF\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success '--set-upstream-to shows warning if used to set branch as own upstream' '\n> +\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n> +\tcat >expected <<EOF &&\n> +warning: Not setting branch my13 as its own upstream.\n> +EOF\n> +\ttest_i18ncmp expected actual\n> +'\n> +\n\nChecking the error message is fine, but we are also interested in\nseeing that we do not leave such a nonsense configuration, if not\nmore.  Shouldn't we check the resulting config as well here?\n\n>  # Keep this test last, as it changes the current branch\n>  cat >expect <<EOF\n>  $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tbranch: Created from master\n"},{"id":"236071","messageId":"1394004715-18776-1-git-send-email-modocache@gmail.com","threadId":"35986","inReplyTo":"xmqqmwh5ikl0.fsf@gitster.dls.corp.google.com","subject":"[PATCH] t3200-branch: test setting branch as own upstream","fromName":"Brian Gesiak","fromEmail":"modocache@gmail.com","sentAt":"2014-03-05T07:31:55Z","receivedAt":"2014-03-05T07:31:55Z","isPatch":true,"sender":{"key":"modocache@gmail.com","avatar":"https://avatars.githubusercontent.com/u/552921?v=4"},"body":"No test asserts that \"git branch -u refs/heads/my-branch my-branch\"\nemits a warning. Add a test that does so.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\n---\n t/t3200-branch.sh | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex fcdb867..e6d4015 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -507,6 +507,16 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--set-upstream-to shows warning if used to set branch as own upstream' '\n+\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n+\tcat >expected <<EOF &&\n+warning: Not setting branch my13 as its own upstream.\n+EOF\n+\ttest_i18ncmp expected actual &&\n+\ttest_must_fail git config branch.my13.remote &&\n+\ttest_must_fail git config branch.my13.merge\n+'\n+\n # Keep this test last, as it changes the current branch\n cat >expect <<EOF\n $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tbranch: Created from master\n-- \n1.8.3.4 (Apple Git-47)\n"},{"id":"236198","messageId":"20140306210025.GD29659@sigill.intra.peff.net","threadId":"35986","inReplyTo":"1394004715-18776-1-git-send-email-modocache@gmail.com","subject":"Re: [PATCH] t3200-branch: test setting branch as own upstream","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-06T21:00:26Z","receivedAt":"2014-03-06T21:00:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 05, 2014 at 04:31:55PM +0900, Brian Gesiak wrote:\n\n> No test asserts that \"git branch -u refs/heads/my-branch my-branch\"\n> emits a warning. Add a test that does so.\n> \n> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n\nThanks, this looks good. Two minor points that may or may not be worth\naddressing:\n\n> +test_expect_success '--set-upstream-to shows warning if used to set branch as own upstream' '\n> +\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n> +\tcat >expected <<EOF &&\n> +warning: Not setting branch my13 as its own upstream.\n> +EOF\n\nIf you spell the EOF marker as:\n\n    cat >expect <<-\\EOF\n\nthen:\n\n  1. The shell does not interpolate the contents (it does not matter\n     here, but it is a good habit to be in, so we typically do it unless\n     there is a need to interpolate).\n\n  2. Using <<- will strip leading tabs, so the content can be indented\n     properly along with the rest of the test.\n\n> +\ttest_i18ncmp expected actual &&\n> +\ttest_must_fail git config branch.my13.remote &&\n> +\ttest_must_fail git config branch.my13.merge\n\nI think we could tighten these to:\n\n  test_expect_code 1 git config branch.my13.remote\n\nto eliminate a false-positive success on other config errors. It's\nhighly improbable for it to ever matter, though (and it looks like we\nare not so careful in most other places that call \"git config\" looking\nfor a missing entry, either).\n\n-Peff\n"},{"id":"236209","messageId":"xmqqa9d3vvrm.fsf@gitster.dls.corp.google.com","threadId":"35986","inReplyTo":"20140306210025.GD29659@sigill.intra.peff.net","subject":"Re: [PATCH] t3200-branch: test setting branch as own upstream","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-06T21:53:49Z","receivedAt":"2014-03-06T21:53:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Mar 05, 2014 at 04:31:55PM +0900, Brian Gesiak wrote:\n>\n>> No test asserts that \"git branch -u refs/heads/my-branch my-branch\"\n>> emits a warning. Add a test that does so.\n>> \n>> Signed-off-by: Brian Gesiak <modocache@gmail.com>\n>\n> Thanks, this looks good. Two minor points that may or may not be worth\n> addressing:\n>\n>> +test_expect_success '--set-upstream-to shows warning if used to set branch as own upstream' '\n>> +\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n>> +\tcat >expected <<EOF &&\n>> +warning: Not setting branch my13 as its own upstream.\n>> +EOF\n>\n> If you spell the EOF marker as:\n>\n>     cat >expect <<-\\EOF\n>\n> then:\n>\n>   1. The shell does not interpolate the contents (it does not matter\n>      here, but it is a good habit to be in, so we typically do it unless\n>      there is a need to interpolate).\n>\n>   2. Using <<- will strip leading tabs, so the content can be indented\n>      properly along with the rest of the test.\n>\n>> +\ttest_i18ncmp expected actual &&\n>> +\ttest_must_fail git config branch.my13.remote &&\n>> +\ttest_must_fail git config branch.my13.merge\n>\n> I think we could tighten these to:\n>\n>   test_expect_code 1 git config branch.my13.remote\n>\n> to eliminate a false-positive success on other config errors. It's\n> highly improbable for it to ever matter, though (and it looks like we\n> are not so careful in most other places that call \"git config\" looking\n> for a missing entry, either).\n\nSounds good.  Here is what I'll re-queue.\n\n-- >8 --\nFrom: Brian Gesiak <modocache@gmail.com>\nDate: Wed, 5 Mar 2014 16:31:55 +0900\nSubject: [PATCH] t3200-branch: test setting branch as own upstream\n\nNo test asserts that \"git branch -u refs/heads/my-branch my-branch\"\navoids leaving nonsense configuration and emits a warning.\n\nAdd a test that does so.\n\nSigned-off-by: Brian Gesiak <modocache@gmail.com>\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t3200-branch.sh | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex fcdb867..83037b1 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -507,6 +507,16 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '\n+\tgit branch --set-upstream-to refs/heads/my13 my13 2>actual &&\n+\tcat >expected <<-\\EOF &&\n+\twarning: Not setting branch my13 as its own upstream.\n+\tEOF\n+\ttest_expect_code 1 git config branch.my13.remote &&\n+\ttest_expect_code 1 git config branch.my13.merge &&\n+\ttest_i18ncmp expected actual\n+'\n+\n # Keep this test last, as it changes the current branch\n cat >expect <<EOF\n $_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tbranch: Created from master\n-- \n1.9.0-192-g8dd89d4\n"}]}