summaryrefslogtreecommitdiff
path: root/t/t2017-checkout-orphan.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-07-21 12:47:48 -0700
committerJunio C Hamano <gitster@pobox.com>2010-07-21 12:54:48 -0700
commit6e6842e36f8c6c12ae0ddd7db98cd900b25bb8dc (patch)
tree1051969ab2b08d04431f2c44fd89b8f8479c5415 /t/t2017-checkout-orphan.sh
parentb1edaf669d483e983f1849ce804baa178387e9a9 (diff)
downloadgit-6e6842e36f8c6c12ae0ddd7db98cd900b25bb8dc.tar.gz
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>
Diffstat (limited to 't/t2017-checkout-orphan.sh')
-rwxr-xr-xt/t2017-checkout-orphan.sh47
1 files changed, 8 insertions, 39 deletions
diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh
index 81cb393a95..2d2f63f22e 100755
--- a/t/t2017-checkout-orphan.sh
+++ b/t/t2017-checkout-orphan.sh
@@ -68,65 +68,34 @@ test_expect_success '--orphan makes reflog by default' '
git checkout master &&
git config --unset core.logAllRefUpdates &&
git checkout --orphan delta &&
- ! test -f .git/logs/refs/heads/delta &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show delta
- ) &&
+ test_must_fail git rev-parse --verify delta@{0} &&
git commit -m Delta &&
- test -f .git/logs/refs/heads/delta &&
- PAGER= git reflog show delta
+ git rev-parse --verify delta@{0}
'
test_expect_success '--orphan does not make reflog when core.logAllRefUpdates = false' '
git checkout master &&
git config core.logAllRefUpdates false &&
git checkout --orphan epsilon &&
- ! test -f .git/logs/refs/heads/epsilon &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show epsilon
- ) &&
+ test_must_fail git rev-parse --verify epsilon@{0} &&
git commit -m Epsilon &&
- ! test -f .git/logs/refs/heads/epsilon &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show epsilon
- )
+ test_must_fail git rev-parse --verify epsilon@{0}
'
test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates = false' '
git checkout master &&
git checkout -l --orphan zeta &&
- test -f .git/logs/refs/heads/zeta &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show zeta
- ) &&
+ test_must_fail git rev-parse --verify zeta@{0} &&
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' '
git checkout master &&
git checkout -l --orphan eta &&
- test -f .git/logs/refs/heads/eta &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show eta
- ) &&
+ test_must_fail git rev-parse --verify eta@{0} &&
git checkout master &&
- ! test -f .git/logs/refs/heads/eta &&
- (
- PAGER= &&
- export PAGER &&
- test_must_fail git reflog show eta
- )
+ test_must_fail git rev-parse --verify eta@{0}
'
test_expect_success '--orphan is rejected with an existing name' '