Eric Sunshine <[email protected]> writes:
>> +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.
In the meantime, here is what I'll have in 'pu' on top.
t/t3203-branch-output.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index 1bf708dffc..d1f4fec9de 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -119,12 +119,14 @@ 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" &&
+ test_when_finished "
+ git checkout branch-one
+ 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 &&
test_cmp expect actual
'
@@ -137,8 +139,7 @@ test_expect_success 'git branch `--show-current` works
properly with worktrees'
git worktree add worktree branch-two &&
(
git branch --show-current &&
- cd worktree &&
- git branch --show-current
+ git -C worktree branch --show-current
) >actual &&
test_cmp expect actual
'
--
2.19.1-328-g5a0cc8aca7