Skip to content

Commit e22148f

Browse files
committed
t3101: modernise style
Also add a few " &&" cascade that were missing. Signed-off-by: Junio C Hamano <[email protected]>
1 parent d555ff5 commit e22148f

File tree

1 file changed

+64
-62
lines changed

1 file changed

+64
-62
lines changed

t/t3101-ls-tree-dirname.sh

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,46 @@ entries. Also test odd filename and missing entries handling.
2121
'
2222
. ./test-lib.sh
2323

24-
test_expect_success \
25-
'setup' \
26-
'echo 111 >1.txt &&
27-
echo 222 >2.txt &&
28-
mkdir path0 path0/a path0/a/b path0/a/b/c &&
29-
echo 111 >path0/a/b/c/1.txt &&
30-
mkdir path1 path1/b path1/b/c &&
31-
echo 111 >path1/b/c/1.txt &&
32-
mkdir path2 &&
33-
echo 111 >path2/1.txt &&
34-
mkdir path3 &&
35-
echo 111 >path3/1.txt &&
36-
echo 222 >path3/2.txt &&
37-
find *.txt path* \( -type f -o -type l \) -print |
38-
xargs git update-index --add &&
39-
tree=`git write-tree` &&
40-
echo $tree'
24+
test_expect_success 'setup' '
25+
echo 111 >1.txt &&
26+
echo 222 >2.txt &&
27+
mkdir path0 path0/a path0/a/b path0/a/b/c &&
28+
echo 111 >path0/a/b/c/1.txt &&
29+
mkdir path1 path1/b path1/b/c &&
30+
echo 111 >path1/b/c/1.txt &&
31+
mkdir path2 &&
32+
echo 111 >path2/1.txt &&
33+
mkdir path3 &&
34+
echo 111 >path3/1.txt &&
35+
echo 222 >path3/2.txt &&
36+
find *.txt path* \( -type f -o -type l \) -print |
37+
xargs git update-index --add &&
38+
tree=`git write-tree` &&
39+
echo $tree
40+
'
4141

4242
test_output () {
43-
sed -e "s/ $_x40 / X /" <current >check
44-
test_cmp expected check
43+
sed -e "s/ $_x40 / X /" <current >check &&
44+
test_cmp expected check
4545
}
4646

47-
test_expect_success \
48-
'ls-tree plain' \
49-
'git ls-tree $tree >current &&
50-
cat >expected <<\EOF &&
47+
test_expect_success 'ls-tree plain' '
48+
git ls-tree $tree >current &&
49+
cat >expected <<\EOF &&
5150
100644 blob X 1.txt
5251
100644 blob X 2.txt
5352
040000 tree X path0
5453
040000 tree X path1
5554
040000 tree X path2
5655
040000 tree X path3
5756
EOF
58-
test_output'
57+
test_output
58+
'
5959

6060
# Recursive does not show tree nodes anymore...
61-
test_expect_success \
62-
'ls-tree recursive' \
63-
'git ls-tree -r $tree >current &&
64-
cat >expected <<\EOF &&
61+
test_expect_success 'ls-tree recursive' '
62+
git ls-tree -r $tree >current &&
63+
cat >expected <<\EOF &&
6564
100644 blob X 1.txt
6665
100644 blob X 2.txt
6766
100644 blob X path0/a/b/c/1.txt
@@ -70,68 +69,71 @@ test_expect_success \
7069
100644 blob X path3/1.txt
7170
100644 blob X path3/2.txt
7271
EOF
73-
test_output'
72+
test_output
73+
'
7474

75-
test_expect_success \
76-
'ls-tree filter 1.txt' \
77-
'git ls-tree $tree 1.txt >current &&
78-
cat >expected <<\EOF &&
75+
test_expect_success 'ls-tree filter 1.txt' '
76+
git ls-tree $tree 1.txt >current &&
77+
cat >expected <<\EOF &&
7978
100644 blob X 1.txt
8079
EOF
81-
test_output'
80+
test_output
81+
'
8282

83-
test_expect_success \
84-
'ls-tree filter path1/b/c/1.txt' \
85-
'git ls-tree $tree path1/b/c/1.txt >current &&
86-
cat >expected <<\EOF &&
83+
test_expect_success 'ls-tree filter path1/b/c/1.txt' '
84+
git ls-tree $tree path1/b/c/1.txt >current &&
85+
cat >expected <<\EOF &&
8786
100644 blob X path1/b/c/1.txt
8887
EOF
89-
test_output'
88+
test_output
89+
'
9090

91-
test_expect_success \
92-
'ls-tree filter all 1.txt files' \
93-
'git ls-tree $tree 1.txt path0/a/b/c/1.txt path1/b/c/1.txt path2/1.txt path3/1.txt >current &&
94-
cat >expected <<\EOF &&
91+
test_expect_success 'ls-tree filter all 1.txt files' '
92+
git ls-tree $tree 1.txt path0/a/b/c/1.txt \
93+
path1/b/c/1.txt path2/1.txt path3/1.txt >current &&
94+
cat >expected <<\EOF &&
9595
100644 blob X 1.txt
9696
100644 blob X path0/a/b/c/1.txt
9797
100644 blob X path1/b/c/1.txt
9898
100644 blob X path2/1.txt
9999
100644 blob X path3/1.txt
100100
EOF
101-
test_output'
101+
test_output
102+
'
102103

103104
# I am not so sure about this one after ls-tree doing pathspec match.
104105
# Having both path0/a and path0/a/b/c makes path0/a redundant, and
105106
# it behaves as if path0/a/b/c, path1/b/c, path2 and path3 are specified.
106-
test_expect_success \
107-
'ls-tree filter directories' \
108-
'git ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current &&
109-
cat >expected <<\EOF &&
107+
test_expect_success 'ls-tree filter directories' '
108+
git ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current &&
109+
cat >expected <<\EOF &&
110110
040000 tree X path0/a/b/c
111111
040000 tree X path1/b/c
112112
040000 tree X path2
113113
040000 tree X path3
114114
EOF
115-
test_output'
115+
test_output
116+
'
116117

117118
# Again, duplicates are filtered away so this is equivalent to
118119
# having 1.txt and path3
119-
test_expect_success \
120-
'ls-tree filter odd names' \
121-
'git ls-tree $tree 1.txt ./1.txt .//1.txt path3/1.txt path3/./1.txt path3 path3// >current &&
122-
cat >expected <<\EOF &&
120+
test_expect_success 'ls-tree filter odd names' '
121+
git ls-tree $tree 1.txt ./1.txt .//1.txt \
122+
path3/1.txt path3/./1.txt path3 path3// >current &&
123+
cat >expected <<\EOF &&
123124
100644 blob X 1.txt
124125
100644 blob X path3/1.txt
125126
100644 blob X path3/2.txt
126127
EOF
127-
test_output'
128+
test_output
129+
'
128130

129-
test_expect_success \
130-
'ls-tree filter missing files and extra slashes' \
131-
'git ls-tree $tree 1.txt/ abc.txt path3//23.txt path3/2.txt/// >current &&
132-
cat >expected <<\EOF &&
133-
EOF
134-
test_output'
131+
test_expect_success 'ls-tree filter missing files and extra slashes' '
132+
git ls-tree $tree 1.txt/ abc.txt \
133+
path3//23.txt path3/2.txt/// >current &&
134+
>expected &&
135+
test_output
136+
'
135137

136138
test_expect_success 'ls-tree filter is leading path match' '
137139
git ls-tree $tree pa path3/a >current &&
@@ -198,7 +200,7 @@ EOF
198200
'
199201

200202
test_expect_success 'ls-tree --name-only' '
201-
git ls-tree --name-only $tree >current
203+
git ls-tree --name-only $tree >current &&
202204
cat >expected <<\EOF &&
203205
1.txt
204206
2.txt
@@ -211,7 +213,7 @@ EOF
211213
'
212214

213215
test_expect_success 'ls-tree --name-only -r' '
214-
git ls-tree --name-only -r $tree >current
216+
git ls-tree --name-only -r $tree >current &&
215217
cat >expected <<\EOF &&
216218
1.txt
217219
2.txt

0 commit comments

Comments
 (0)