Re: [PATCH v2 1/1] branch: introduce --show-current display option
On Wed, Oct 10, 2018 at 10:54:32PM +0200, Daniels Umanovskis wrote:
[...]
Show 13 quoted lines
> diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
> index ee6787614..e9bc3b05f 100755
> --- a/t/t3203-branch-output.sh
> +++ b/t/t3203-branch-output.sh
> @@ -100,6 +100,47 @@ test_expect_success 'git branch -v pattern does not show branch summaries' '
> test_must_fail git branch -v branch*
> '
>
> +test_expect_success 'git branch `--show-current` shows current branch' '
> + cat >expect <<-\EOF &&
> + branch-two
> + EOF
> + git checkout branch-two &&
Up to this point everything talked about '--show-current' ...
> + git branch --current >actual &&
... but here and in all the following tests you run
git branch --current
which then fails with "error: unknown option `current'"
Show 41 quoted lines
> + test_cmp expect actual
> +'
> +
> +test_expect_success 'git branch `--show-current` is silent when detached HEAD' '
> + git checkout HEAD^0 &&
> + git branch --current >actual &&
> + test_must_be_empty actual
> +'
> +
> +test_expect_success 'git branch `--show-current` works properly when tag exists' '
> + cat >expect <<-\EOF &&
> + branch-and-tag-name
> + EOF
> + git checkout -b branch-and-tag-name &&
> + git tag branch-and-tag-name &&
> + git branch --current >actual &&
> + git checkout branch-one &&
> + git branch -d branch-and-tag-name &&
> + test_cmp expect actual
> +'
> +
> +test_expect_success 'git branch `--show-current` works properly with worktrees' '
> + cat >expect <<-\EOF &&
> + branch-one
> + branch-two
> + EOF
> + git checkout branch-one &&
> + git branch --current >actual &&
> + git worktree add worktree branch-two &&
> + cd worktree &&
> + git branch --current >>../actual &&
> + cd .. &&
> + test_cmp expect actual
> +'
> +
> test_expect_success 'git branch shows detached HEAD properly' '
> cat >expect <<EOF &&
> * (HEAD detached at $(git rev-parse --short HEAD^0))
> --
> 2.19.1.330.g93276587c.dirty
>