On Fri, Oct 12, 2018 at 9:34 AM Daniels Umanovskis <daniels@xxxxxxxxxxxxx> wrote: > 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@xxxxxxxxxxxxx> > --- > 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 > +'