{"thread":{"id":"53680","subject":"[PATCH 0/3] branch and t3200 cleanup","startedAt":"2020-06-15T11:53:31Z","lastAt":"2020-06-17T18:12:55Z","messageCount":6,"participants":["Denton Liu","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"399761","messageId":"cover.1592221875.git.liu.denton@gmail.com","threadId":"53680","inReplyTo":null,"subject":"[PATCH 0/3] branch and t3200 cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-15T11:53:17Z","receivedAt":"2020-06-15T11:53:31Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"I was looking through some old patches that I had sitting around. In one\nset of these, I implemented `git branch --set-remote-to` but I\nultimately decided that the idea was stupid. However, these patches are\nsalvageable so I'll send them in.\n\nDenton Liu (3):\n  t3200: rename \"expected\" to \"expect\"\n  t3200: test for specific errors\n  branch: don't mix --edit-description\n\n builtin/branch.c  |  2 +-\n t/t3200-branch.sh | 67 ++++++++++++++++++++++++++++++-----------------\n 2 files changed, 44 insertions(+), 25 deletions(-)\n\n-- \n2.27.0.132.g321788e831\n\n"},{"id":"399762","messageId":"5fa405d7e1672ef18442cdcd514698c92e139a8e.1592221875.git.liu.denton@gmail.com","threadId":"53680","inReplyTo":"cover.1592221875.git.liu.denton@gmail.com","subject":"[PATCH 1/3] t3200: rename \"expected\" to \"expect\"","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-15T11:53:18Z","receivedAt":"2020-06-15T11:53:32Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Clean up style of test by changing some filenames from \"expected\" to\n\"expect\", which follows typical test convention.\n\nAlso, change a space-indent into a tab-indent.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t3200-branch.sh | 22 +++++++++++-----------\n 1 file changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 411a70b0ce..da3659c3d3 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -323,11 +323,11 @@ test_expect_success 'git branch --list -v with --abbrev' '\n \n test_expect_success 'git branch --column' '\n \tCOLUMNS=81 git branch --column=column >actual &&\n-\tcat >expected <<\\EOF &&\n+\tcat >expect <<\\EOF &&\n   a/b/c     bam       foo       l       * master    mb        o/o       q\n   abc       bar       j/k       m/m       master2   n         o/p       r\n EOF\n-\ttest_cmp expected actual\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'git branch --column with an extremely long branch name' '\n@@ -336,7 +336,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '\n \ttest_when_finished \"git branch -d $long\" &&\n \tgit branch $long &&\n \tCOLUMNS=80 git branch --column=column >actual &&\n-\tcat >expected <<EOF &&\n+\tcat >expect <<EOF &&\n   a/b/c\n   abc\n   bam\n@@ -355,7 +355,7 @@ test_expect_success 'git branch --column with an extremely long branch name' '\n   r\n   $long\n EOF\n-\ttest_cmp expected actual\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'git branch with column.*' '\n@@ -364,11 +364,11 @@ test_expect_success 'git branch with column.*' '\n \tCOLUMNS=80 git branch >actual &&\n \tgit config --unset column.branch &&\n \tgit config --unset column.ui &&\n-\tcat >expected <<\\EOF &&\n+\tcat >expect <<\\EOF &&\n   a/b/c   bam   foo   l   * master    mb   o/o   q\n   abc     bar   j/k   m/m   master2   n    o/p   r\n EOF\n-\ttest_cmp expected actual\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'git branch --column -v should fail' '\n@@ -379,7 +379,7 @@ test_expect_success 'git branch -v with column.ui ignored' '\n \tgit config column.ui column &&\n \tCOLUMNS=80 git branch -v | cut -c -10 | sed \"s/ *$//\" >actual &&\n \tgit config --unset column.ui &&\n-\tcat >expected <<\\EOF &&\n+\tcat >expect <<\\EOF &&\n   a/b/c\n   abc\n   bam\n@@ -397,7 +397,7 @@ test_expect_success 'git branch -v with column.ui ignored' '\n   q\n   r\n EOF\n-\ttest_cmp expected actual\n+\ttest_cmp expect actual\n '\n \n mv .git/config .git/config-saved\n@@ -922,17 +922,17 @@ test_expect_success 'test --unset-upstream on a particular branch' '\n '\n \n test_expect_success 'disabled option --set-upstream fails' '\n-    test_must_fail git branch --set-upstream origin/master\n+\ttest_must_fail git branch --set-upstream origin/master\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+\tcat >expect <<-\\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+\ttest_i18ncmp expect actual\n '\n \n # Keep this test last, as it changes the current branch\n-- \n2.27.0.132.g321788e831\n\n"},{"id":"399763","messageId":"e787b581c3a86b9de51dc21dc90bd1685309313e.1592221875.git.liu.denton@gmail.com","threadId":"53680","inReplyTo":"cover.1592221875.git.liu.denton@gmail.com","subject":"[PATCH 2/3] t3200: test for specific errors","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-15T11:53:19Z","receivedAt":"2020-06-15T11:53:33Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the \"--set-upstream-to\" and \"--unset-upstream\" tests, specific error\nconditions are being tested. However, there is no way of ensuring that a\ntest case is failing because of some specific error.\n\nCheck stderr of failing commands to ensure that they are failing in the\nexpected way.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t3200-branch.sh | 45 ++++++++++++++++++++++++++++++++-------------\n 1 file changed, 32 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex da3659c3d3..1fd03cae80 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -835,32 +835,42 @@ test_expect_success 'branch from tag w/--track causes failure' '\n '\n \n test_expect_success '--set-upstream-to fails on multiple branches' '\n-\ttest_must_fail git branch --set-upstream-to master a b c\n+\techo \"fatal: too many arguments to set new upstream\" >expect &&\n+\ttest_must_fail git branch --set-upstream-to master a b c 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--set-upstream-to fails on detached HEAD' '\n \tgit checkout HEAD^{} &&\n-\ttest_must_fail git branch --set-upstream-to master &&\n-\tgit checkout -\n+\ttest_when_finished git checkout - &&\n+\techo \"fatal: could not set upstream of HEAD to master when it does not point to any branch.\" >expect &&\n+\ttest_must_fail git branch --set-upstream-to master 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--set-upstream-to fails on a missing dst branch' '\n-\ttest_must_fail git branch --set-upstream-to master does-not-exist\n+\techo \"fatal: branch '\"'\"'does-not-exist'\"'\"' does not exist\" >expect &&\n+\ttest_must_fail git branch --set-upstream-to master does-not-exist 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--set-upstream-to fails on a missing src branch' '\n-\ttest_must_fail git branch --set-upstream-to does-not-exist master\n+\ttest_must_fail git branch --set-upstream-to does-not-exist master 2>err &&\n+\ttest_i18ngrep \"the requested upstream branch '\"'\"'does-not-exist'\"'\"' does not exist\" err\n '\n \n test_expect_success '--set-upstream-to fails on a non-ref' '\n-\ttest_must_fail git branch --set-upstream-to HEAD^{}\n+\techo \"fatal: Cannot setup tracking information; starting point '\"'\"'HEAD^{}'\"'\"' is not a branch.\" >expect &&\n+\ttest_must_fail git branch --set-upstream-to HEAD^{} 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--set-upstream-to fails on locked config' '\n \ttest_when_finished \"rm -f .git/config.lock\" &&\n \t>.git/config.lock &&\n \tgit branch locked &&\n-\ttest_must_fail git branch --set-upstream-to locked\n+\ttest_must_fail git branch --set-upstream-to locked 2>err &&\n+\ttest_i18ngrep \"could not lock config file .git/config: File exists\" err\n '\n \n test_expect_success 'use --set-upstream-to modify HEAD' '\n@@ -881,14 +891,17 @@ test_expect_success 'use --set-upstream-to modify a particular branch' '\n '\n \n test_expect_success '--unset-upstream should fail if given a non-existent branch' '\n-\ttest_must_fail git branch --unset-upstream i-dont-exist\n+\techo \"fatal: Branch '\"'\"'i-dont-exist'\"'\"' has no upstream information\" >expect &&\n+\ttest_must_fail git branch --unset-upstream i-dont-exist 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--unset-upstream should fail if config is locked' '\n \ttest_when_finished \"rm -f .git/config.lock\" &&\n \tgit branch --set-upstream-to locked &&\n \t>.git/config.lock &&\n-\ttest_must_fail git branch --unset-upstream\n+\ttest_must_fail git branch --unset-upstream 2>err &&\n+\ttest_i18ngrep \"could not lock config file .git/config: File exists\" err\n '\n \n test_expect_success 'test --unset-upstream on HEAD' '\n@@ -900,17 +913,23 @@ test_expect_success 'test --unset-upstream on HEAD' '\n \ttest_must_fail git config branch.master.remote &&\n \ttest_must_fail git config branch.master.merge &&\n \t# fail for a branch without upstream set\n-\ttest_must_fail git branch --unset-upstream\n+\techo \"fatal: Branch '\"'\"'master'\"'\"' has no upstream information\" >expect &&\n+\ttest_must_fail git branch --unset-upstream 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--unset-upstream should fail on multiple branches' '\n-\ttest_must_fail git branch --unset-upstream a b c\n+\techo \"fatal: too many arguments to unset upstream\" >expect &&\n+\ttest_must_fail git branch --unset-upstream a b c 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success '--unset-upstream should fail on detached HEAD' '\n \tgit checkout HEAD^{} &&\n-\ttest_must_fail git branch --unset-upstream &&\n-\tgit checkout -\n+\ttest_when_finished git checkout - &&\n+\techo \"fatal: could not unset upstream of HEAD when it does not point to any branch.\" >expect &&\n+\ttest_must_fail git branch --unset-upstream 2>err &&\n+\ttest_i18ncmp expect err\n '\n \n test_expect_success 'test --unset-upstream on a particular branch' '\n-- \n2.27.0.132.g321788e831\n\n"},{"id":"399764","messageId":"1d0eebd1ecf24db0241801af31d904a19ad391a8.1592221875.git.liu.denton@gmail.com","threadId":"53680","inReplyTo":"cover.1592221875.git.liu.denton@gmail.com","subject":"[PATCH 3/3] branch: don't mix --edit-description","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-15T11:53:20Z","receivedAt":"2020-06-15T11:53:34Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"`git branch` accepts `--edit-description` in conjunction with other\narguments. However, `--edit-description` is its own mode, similar to\n`--set-upstream-to`, which is also made mutually exclusive with other\nmodes. Prevent `--edit-description` from being mixed with other modes.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n builtin/branch.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex accb61b1aa..99633ad004 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -693,7 +693,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tlist = 1;\n \n \tif (!!delete + !!rename + !!copy + !!new_upstream + !!show_current +\n-\t    list + unset_upstream > 1)\n+\t    list + edit_description + unset_upstream > 1)\n \t\tusage_with_options(builtin_branch_usage, options);\n \n \tif (filter.abbrev == -1)\n-- \n2.27.0.132.g321788e831\n\n"},{"id":"399984","messageId":"xmqqv9jpva1j.fsf@gitster.c.googlers.com","threadId":"53680","inReplyTo":"1d0eebd1ecf24db0241801af31d904a19ad391a8.1592221875.git.liu.denton@gmail.com","subject":"Re: [PATCH 3/3] branch: don't mix --edit-description","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-17T18:09:44Z","receivedAt":"2020-06-17T18:09:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> `git branch` accepts `--edit-description` in conjunction with other\n> arguments. However, `--edit-description` is its own mode, similar to\n> `--set-upstream-to`, which is also made mutually exclusive with other\n> modes. Prevent `--edit-description` from being mixed with other modes.\n\nMakes sense.  Do we have some \"these options are mutually exclusive\"\ntest?\n\nIt makes me wonder if this can/should be switched to OPT_CMDMODE()\nso that we do not have to write this if statement in the first\nplace.\n\n\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  builtin/branch.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/branch.c b/builtin/branch.c\n> index accb61b1aa..99633ad004 100644\n> --- a/builtin/branch.c\n> +++ b/builtin/branch.c\n> @@ -693,7 +693,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n>  \t\tlist = 1;\n>  \n>  \tif (!!delete + !!rename + !!copy + !!new_upstream + !!show_current +\n> -\t    list + unset_upstream > 1)\n> +\t    list + edit_description + unset_upstream > 1)\n>  \t\tusage_with_options(builtin_branch_usage, options);\n>  \n>  \tif (filter.abbrev == -1)\n"},{"id":"399985","messageId":"xmqqr1udv9wh.fsf@gitster.c.googlers.com","threadId":"53680","inReplyTo":"cover.1592221875.git.liu.denton@gmail.com","subject":"Re: [PATCH 0/3] branch and t3200 cleanup","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-17T18:12:46Z","receivedAt":"2020-06-17T18:12:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> I was looking through some old patches that I had sitting around. In one\n> set of these, I implemented `git branch --set-remote-to` but I\n> ultimately decided that the idea was stupid. However, these patches are\n> salvageable so I'll send them in.\n>\n> Denton Liu (3):\n>   t3200: rename \"expected\" to \"expect\"\n>   t3200: test for specific errors\n>   branch: don't mix --edit-description\n>\n>  builtin/branch.c  |  2 +-\n>  t/t3200-branch.sh | 67 ++++++++++++++++++++++++++++++-----------------\n>  2 files changed, 44 insertions(+), 25 deletions(-)\n\nThnaks, will queue.\n"}]}