Skip to content

Commit

Permalink
t/: work around one-shot variable assignment with test_must_fail
Browse files Browse the repository at this point in the history
See e200783

Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
drafnel authored and gitster committed Jul 21, 2010
1 parent bdcaa32 commit b1edaf6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
36 changes: 30 additions & 6 deletions t/t2017-checkout-orphan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ test_expect_success '--orphan makes reflog by default' '
git config --unset core.logAllRefUpdates &&
git checkout --orphan delta &&
! test -f .git/logs/refs/heads/delta &&
test_must_fail PAGER= git reflog show delta &&
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show delta
) &&
git commit -m Delta &&
test -f .git/logs/refs/heads/delta &&
PAGER= git reflog show delta
Expand All @@ -80,17 +84,29 @@ test_expect_success '--orphan does not make reflog when core.logAllRefUpdates =
git config core.logAllRefUpdates false &&
git checkout --orphan epsilon &&
! test -f .git/logs/refs/heads/epsilon &&
test_must_fail PAGER= git reflog show epsilon &&
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show epsilon
) &&
git commit -m Epsilon &&
! test -f .git/logs/refs/heads/epsilon &&
test_must_fail PAGER= git reflog show epsilon
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show epsilon
)
'

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 &&
test_must_fail PAGER= git reflog show zeta &&
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show zeta
) &&
git commit -m Zeta &&
PAGER= git reflog show zeta
'
Expand All @@ -99,10 +115,18 @@ test_expect_success 'giving up --orphan not committed when -l and core.logAllRef
git checkout master &&
git checkout -l --orphan eta &&
test -f .git/logs/refs/heads/eta &&
test_must_fail PAGER= git reflog show eta &&
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show eta
) &&
git checkout master &&
! test -f .git/logs/refs/heads/eta &&
test_must_fail PAGER= git reflog show eta
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show eta
)
'

test_expect_success '--orphan is rejected with an existing name' '
Expand Down
6 changes: 5 additions & 1 deletion t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates
git config core.logAllRefUpdates false &&
git checkout -b beta &&
! test -f .git/logs/refs/heads/beta &&
test_must_fail PAGER= git reflog show beta
(
PAGER= &&
export PAGER &&
test_must_fail git reflog show beta
)
'

test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
Expand Down
6 changes: 5 additions & 1 deletion t/t3301-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ test_expect_success 'create note from non-existing note with "git notes add -c"
git add a10 &&
test_tick &&
git commit -m 10th &&
test_must_fail MSG="yet another note" git notes add -c deadbeef &&
(
MSG="yet another note" &&
export MSG &&
test_must_fail git notes add -c deadbeef
) &&
test_must_fail git notes list HEAD
'

Expand Down

0 comments on commit b1edaf6

Please sign in to comment.