t7512: test "detached from" as well

b397ea4863 (status: show more info than "currently not on any
branch", 2013-03-13) wanted to make sure that after a checkout to
detach HEAD, the user can see where the HEAD was originally detached
from.  The last test added by that commit to t7512 shows one
example, immediately after HEAD is detached.  Enhance that test to
show "detached HEAD from" form that should be shown when the user
further resetted to another commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2013-06-17 09:52:25 -07:00
parent edca415256
commit 46ab7d46ca

View file

@ -667,7 +667,7 @@ test_expect_success 'status when cherry-picking after resolving conflicts' '
test_i18ncmp expected actual
'
test_expect_success 'status showing detached from a tag' '
test_expect_success 'status showing detached at and from a tag' '
test_commit atag tagging &&
git checkout atag &&
cat >expected <<-\EOF
@ -675,6 +675,14 @@ test_expect_success 'status showing detached from a tag' '
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
test_i18ncmp expected actual &&
git reset --hard HEAD^ &&
cat >expected <<-\EOF
# HEAD detached from atag
nothing to commit (use -u to show untracked files)
EOF
git status --untracked-files=no >actual &&
test_i18ncmp expected actual
'