Skip to content

Commit b1edaf6

Browse files
drafnelgitster
authored andcommitted
t/: work around one-shot variable assignment with test_must_fail
See e200783 Signed-off-by: Junio C Hamano <[email protected]>
1 parent bdcaa32 commit b1edaf6

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

t/t2017-checkout-orphan.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ test_expect_success '--orphan makes reflog by default' '
6969
git config --unset core.logAllRefUpdates &&
7070
git checkout --orphan delta &&
7171
! test -f .git/logs/refs/heads/delta &&
72-
test_must_fail PAGER= git reflog show delta &&
72+
(
73+
PAGER= &&
74+
export PAGER &&
75+
test_must_fail git reflog show delta
76+
) &&
7377
git commit -m Delta &&
7478
test -f .git/logs/refs/heads/delta &&
7579
PAGER= git reflog show delta
@@ -80,17 +84,29 @@ test_expect_success '--orphan does not make reflog when core.logAllRefUpdates =
8084
git config core.logAllRefUpdates false &&
8185
git checkout --orphan epsilon &&
8286
! test -f .git/logs/refs/heads/epsilon &&
83-
test_must_fail PAGER= git reflog show epsilon &&
87+
(
88+
PAGER= &&
89+
export PAGER &&
90+
test_must_fail git reflog show epsilon
91+
) &&
8492
git commit -m Epsilon &&
8593
! test -f .git/logs/refs/heads/epsilon &&
86-
test_must_fail PAGER= git reflog show epsilon
94+
(
95+
PAGER= &&
96+
export PAGER &&
97+
test_must_fail git reflog show epsilon
98+
)
8799
'
88100

89101
test_expect_success '--orphan with -l makes reflog when core.logAllRefUpdates = false' '
90102
git checkout master &&
91103
git checkout -l --orphan zeta &&
92104
test -f .git/logs/refs/heads/zeta &&
93-
test_must_fail PAGER= git reflog show zeta &&
105+
(
106+
PAGER= &&
107+
export PAGER &&
108+
test_must_fail git reflog show zeta
109+
) &&
94110
git commit -m Zeta &&
95111
PAGER= git reflog show zeta
96112
'
@@ -99,10 +115,18 @@ test_expect_success 'giving up --orphan not committed when -l and core.logAllRef
99115
git checkout master &&
100116
git checkout -l --orphan eta &&
101117
test -f .git/logs/refs/heads/eta &&
102-
test_must_fail PAGER= git reflog show eta &&
118+
(
119+
PAGER= &&
120+
export PAGER &&
121+
test_must_fail git reflog show eta
122+
) &&
103123
git checkout master &&
104124
! test -f .git/logs/refs/heads/eta &&
105-
test_must_fail PAGER= git reflog show eta
125+
(
126+
PAGER= &&
127+
export PAGER &&
128+
test_must_fail git reflog show eta
129+
)
106130
'
107131

108132
test_expect_success '--orphan is rejected with an existing name' '

t/t3200-branch.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates
237237
git config core.logAllRefUpdates false &&
238238
git checkout -b beta &&
239239
! test -f .git/logs/refs/heads/beta &&
240-
test_must_fail PAGER= git reflog show beta
240+
(
241+
PAGER= &&
242+
export PAGER &&
243+
test_must_fail git reflog show beta
244+
)
241245
'
242246

243247
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '

t/t3301-notes.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,11 @@ test_expect_success 'create note from non-existing note with "git notes add -c"
693693
git add a10 &&
694694
test_tick &&
695695
git commit -m 10th &&
696-
test_must_fail MSG="yet another note" git notes add -c deadbeef &&
696+
(
697+
MSG="yet another note" &&
698+
export MSG &&
699+
test_must_fail git notes add -c deadbeef
700+
) &&
697701
test_must_fail git notes list HEAD
698702
'
699703

0 commit comments

Comments
 (0)