зеркало из https://github.com/microsoft/git.git
tests: correct "does reflog exist?" tests
These two tests weren't about how "git reflog show <branch>" exits when there is no reflog, but were about "checkout" and "branch" create or not create reflog when creating a new <branch>. Update the tests to check what we are interested in, using "git rev-parse --verify". Also lose tests based on "test -f .git/logs/refs/heads/<branch>" from nearby, to avoid exposing this particular implementation detail unnecessarily. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
b1edaf669d
Коммит
6e6842e36f
|
@ -68,65 +68,34 @@ test_expect_success '--orphan makes reflog by default' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git config --unset core.logAllRefUpdates &&
|
git config --unset core.logAllRefUpdates &&
|
||||||
git checkout --orphan delta &&
|
git checkout --orphan delta &&
|
||||||
! test -f .git/logs/refs/heads/delta &&
|
test_must_fail git rev-parse --verify delta@{0} &&
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show delta
|
|
||||||
) &&
|
|
||||||
git commit -m Delta &&
|
git commit -m Delta &&
|
||||||
test -f .git/logs/refs/heads/delta &&
|
git rev-parse --verify delta@{0}
|
||||||
PAGER= git reflog show delta
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '
|
test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git config core.logAllRefUpdates false &&
|
git config core.logAllRefUpdates false &&
|
||||||
git checkout --orphan epsilon &&
|
git checkout --orphan epsilon &&
|
||||||
! test -f .git/logs/refs/heads/epsilon &&
|
test_must_fail git rev-parse --verify epsilon@{0} &&
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show epsilon
|
|
||||||
) &&
|
|
||||||
git commit -m Epsilon &&
|
git commit -m Epsilon &&
|
||||||
! test -f .git/logs/refs/heads/epsilon &&
|
test_must_fail git rev-parse --verify epsilon@{0}
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show epsilon
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates = false' '
|
test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates = false' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git checkout -l --orphan zeta &&
|
git checkout -l --orphan zeta &&
|
||||||
test -f .git/logs/refs/heads/zeta &&
|
test_must_fail git rev-parse --verify zeta@{0} &&
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show zeta
|
|
||||||
) &&
|
|
||||||
git commit -m Zeta &&
|
git commit -m Zeta &&
|
||||||
PAGER= git reflog show zeta
|
git rev-parse --verify zeta@{0}
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'giving up --orphan not committed when -l and core.logAllRefUpdates = false deletes reflog' '
|
test_expect_success 'giving up --orphan not committed when -l and core.logAllRefUpdates = false deletes reflog' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git checkout -l --orphan eta &&
|
git checkout -l --orphan eta &&
|
||||||
test -f .git/logs/refs/heads/eta &&
|
test_must_fail git rev-parse --verify eta@{0} &&
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show eta
|
|
||||||
) &&
|
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
! test -f .git/logs/refs/heads/eta &&
|
test_must_fail git rev-parse --verify eta@{0}
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show eta
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '--orphan is rejected with an existing name' '
|
test_expect_success '--orphan is rejected with an existing name' '
|
||||||
|
|
|
@ -228,28 +228,21 @@ test_expect_success 'checkout -b makes reflog by default' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git config --unset core.logAllRefUpdates &&
|
git config --unset core.logAllRefUpdates &&
|
||||||
git checkout -b alpha &&
|
git checkout -b alpha &&
|
||||||
test -f .git/logs/refs/heads/alpha &&
|
git rev-parse --verify alpha@{0}
|
||||||
PAGER= git reflog show alpha
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
|
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git config core.logAllRefUpdates false &&
|
git config core.logAllRefUpdates false &&
|
||||||
git checkout -b beta &&
|
git checkout -b beta &&
|
||||||
! test -f .git/logs/refs/heads/beta &&
|
test_must_fail git rev-parse --verify beta@{0}
|
||||||
(
|
|
||||||
PAGER= &&
|
|
||||||
export PAGER &&
|
|
||||||
test_must_fail git reflog show beta
|
|
||||||
)
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
|
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
|
||||||
git checkout master &&
|
git checkout master &&
|
||||||
git checkout -lb gamma &&
|
git checkout -lb gamma &&
|
||||||
git config --unset core.logAllRefUpdates &&
|
git config --unset core.logAllRefUpdates &&
|
||||||
test -f .git/logs/refs/heads/gamma &&
|
git rev-parse --verify gamma@{0}
|
||||||
PAGER= git reflog show gamma
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'avoid ambiguous track' '
|
test_expect_success 'avoid ambiguous track' '
|
||||||
|
|
Загрузка…
Ссылка в новой задаче