Skip to content

Commit aef591a

Browse files
peffgitster
authored andcommitted
t7201: fix &&-chain breakage
One of these breakages is in setup, but one is more severe and may miss a real test failure. These are pulled out from the rest, though, because we also clean up a few other anachronisms. The most interesting is the use of this here-doc construct: (cat >... <<EOF ... EOF ) && It looks like an attempt to make the &&-chaining more natural by letting it come at the end of the here-doc. But the extra sub-shell is so non-idiomatic (plus the lack of "<<-") that it ends up confusing. Since these are just using a single line, we can accomplish the same thing with a single printf (which also makes the use of tab more obvious than the verbatim whitespace). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 27a6625 commit aef591a

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

t/t7201-co.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,10 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
8888
8989
git checkout -f master &&
9090
fill 0 1 2 3 4 5 6 7 8 >same &&
91-
cp same kept
91+
cp same kept &&
9292
git checkout side >messages &&
93-
test_cmp same kept
94-
(cat > messages.expect <<EOF
95-
M same
96-
EOF
97-
) &&
98-
touch messages.expect &&
93+
test_cmp same kept &&
94+
printf "M\t%s\n" same >messages.expect &&
9995
test_cmp messages.expect messages
10096
'
10197

@@ -109,10 +105,7 @@ test_expect_success "checkout -m with dirty tree" '
109105
110106
test "$(git symbolic-ref HEAD)" = "refs/heads/side" &&
111107
112-
(cat >expect.messages <<EOF
113-
M one
114-
EOF
115-
) &&
108+
printf "M\t%s\n" one >expect.messages &&
116109
test_cmp expect.messages messages &&
117110
118111
fill "M one" "A three" "D two" >expect.master &&
@@ -409,12 +402,12 @@ test_expect_success \
409402

410403
test_expect_success \
411404
'checkout w/autosetupmerge=always sets up tracking' '
405+
test_when_finished git config branch.autosetupmerge false &&
412406
git config branch.autosetupmerge always &&
413407
git checkout master &&
414408
git checkout -b track2 &&
415409
test "$(git config branch.track2.remote)" &&
416-
test "$(git config branch.track2.merge)"
417-
git config branch.autosetupmerge false'
410+
test "$(git config branch.track2.merge)"'
418411

419412
test_expect_success 'checkout w/--track from non-branch HEAD fails' '
420413
git checkout master^0 &&

0 commit comments

Comments
 (0)