Re: [PATCH v4] branch: introduce --show-current display option
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 12, 2018, 13:43 UTC
- Message-ID
- <CAPig+cRCfO=3BB6bvDSKLKkhiSA-4=p4-zZkAXvN446_6B1_HA@mail.gmail.com>
- In-Reply-To
- <20181012133321.20580-1-daniels@umanovskis.se>
On Fri, Oct 12, 2018 at 9:34 AM Daniels Umanovskis <daniels@umanovskis.se> wrote:
Show 18 quoted lines
> When called with --show-current, git branch will print the current > branch name and terminate. Only the actual name gets printed, > without refs/heads. In detached HEAD state, nothing is output. > > Signed-off-by: Daniels Umanovskis <daniels@umanovskis.se> > --- > diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh > @@ -100,6 +100,49 @@ test_expect_success 'git branch -v pattern does not show branch summaries' ' > +test_expect_success 'git branch `--show-current` works properly when tag exists' ' > + cat >expect <<-\EOF && > + branch-and-tag-name > + EOF > + test_when_finished "git branch -D branch-and-tag-name" && > + git checkout -b branch-and-tag-name && > + test_when_finished "git tag -d branch-and-tag-name" && > + git tag branch-and-tag-name && > + git branch --show-current >actual && > + git checkout branch-one &&
This cleanup "checkout" needs to be encapsulated within a test_when_finished(), doesn't it? Preferably just after the "git checkout -b" invocation.
> + test_cmp expect actual > +'