Skip to content

Commit ddea571

Browse files
ffyuandagitster
authored andcommitted
t/lib-read-tree-m-3way: modernize style
Many invocations of the test_expect_success command in this file are written in old style where the command, an optional prerequisite, and the test title are written on separate lines, and the executable script string begins on its own line, and these lines are pasted together with backslashes as necessary. An invocation of the test_expect_success command in modern test scripts however writes the prerequisite and the title on the same line as the test_expect_success command itself, and ends the line with a single quote that begins the executable script string. Update the style for uniformity. Signed-off-by: Shaoxuan Yuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c53a8c commit ddea571

File tree

1 file changed

+77
-77
lines changed

1 file changed

+77
-77
lines changed

t/lib-read-tree-m-3way.sh

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ do
88
p=$a$b
99
echo This is $p from the original tree. >$p
1010
echo This is Z/$p from the original tree. >Z/$p
11-
test_expect_success \
12-
"adding test file $p and Z/$p" \
13-
'git update-index --add $p &&
14-
git update-index --add Z/$p'
11+
test_expect_success "adding test file $p and Z/$p" '
12+
git update-index --add $p &&
13+
git update-index --add Z/$p
14+
'
1515
done
1616
done
1717
echo This is SS from the original tree. >SS
18-
test_expect_success \
19-
'adding test file SS' \
20-
'git update-index --add SS'
18+
test_expect_success 'adding test file SS' '
19+
git update-index --add SS
20+
'
2121
cat >TT <<\EOF
2222
This is a trivial merge sample text.
2323
Branch A is expected to upcase this word, here.
@@ -30,12 +30,12 @@ At the very end, here comes another line, that is
3030
the word, expected to be upcased by Branch B.
3131
This concludes the trivial merge sample file.
3232
EOF
33-
test_expect_success \
34-
'adding test file TT' \
35-
'git update-index --add TT'
36-
test_expect_success \
37-
'prepare initial tree' \
38-
'tree_O=$(git write-tree)'
33+
test_expect_success 'adding test file TT' '
34+
git update-index --add TT
35+
'
36+
test_expect_success 'prepare initial tree' '
37+
tree_O=$(git write-tree)
38+
'
3939

4040
################################################################
4141
# Branch A and B makes the changes according to the above matrix.
@@ -45,114 +45,114 @@ test_expect_success \
4545

4646
to_remove=$(echo D? Z/D?)
4747
rm -f $to_remove
48-
test_expect_success \
49-
'change in branch A (removal)' \
50-
'git update-index --remove $to_remove'
48+
test_expect_success 'change in branch A (removal)' '
49+
git update-index --remove $to_remove
50+
'
5151

5252
for p in M? Z/M?
5353
do
5454
echo This is modified $p in the branch A. >$p
55-
test_expect_success \
56-
'change in branch A (modification)' \
57-
"git update-index $p"
55+
test_expect_success 'change in branch A (modification)' '
56+
git update-index $p
57+
'
5858
done
5959

6060
for p in AN AA Z/AN Z/AA
6161
do
6262
echo This is added $p in the branch A. >$p
63-
test_expect_success \
64-
'change in branch A (addition)' \
65-
"git update-index --add $p"
63+
test_expect_success 'change in branch A (addition)' '
64+
git update-index --add $p
65+
'
6666
done
6767

6868
echo This is SS from the modified tree. >SS
6969
echo This is LL from the modified tree. >LL
70-
test_expect_success \
71-
'change in branch A (addition)' \
72-
'git update-index --add LL &&
73-
git update-index SS'
70+
test_expect_success 'change in branch A (addition)' '
71+
git update-index --add LL &&
72+
git update-index SS
73+
'
7474
mv TT TT-
7575
sed -e '/Branch A/s/word/WORD/g' <TT- >TT
7676
rm -f TT-
77-
test_expect_success \
78-
'change in branch A (edit)' \
79-
'git update-index TT'
77+
test_expect_success 'change in branch A (edit)' '
78+
git update-index TT
79+
'
8080

8181
mkdir DF
8282
echo Branch A makes a file at DF/DF, creating a directory DF. >DF/DF
83-
test_expect_success \
84-
'change in branch A (change file to directory)' \
85-
'git update-index --add DF/DF'
83+
test_expect_success 'change in branch A (change file to directory)' '
84+
git update-index --add DF/DF
85+
'
8686

87-
test_expect_success \
88-
'recording branch A tree' \
89-
'tree_A=$(git write-tree)'
87+
test_expect_success 'recording branch A tree' '
88+
tree_A=$(git write-tree)
89+
'
9090

9191
################################################################
9292
# Branch B
9393
# Start from O
9494

9595
rm -rf [NDMASLT][NDMASLT] Z DF
9696
mkdir Z
97-
test_expect_success \
98-
'reading original tree and checking out' \
99-
'git read-tree $tree_O &&
100-
git checkout-index -a'
97+
test_expect_success 'reading original tree and checking out' '
98+
git read-tree $tree_O &&
99+
git checkout-index -a
100+
'
101101

102102
to_remove=$(echo ?D Z/?D)
103103
rm -f $to_remove
104-
test_expect_success \
105-
'change in branch B (removal)' \
106-
"git update-index --remove $to_remove"
104+
test_expect_success 'change in branch B (removal)' '
105+
git update-index --remove $to_remove
106+
'
107107

108108
for p in ?M Z/?M
109109
do
110110
echo This is modified $p in the branch B. >$p
111-
test_expect_success \
112-
'change in branch B (modification)' \
113-
"git update-index $p"
111+
test_expect_success 'change in branch B (modification)' '
112+
git update-index $p
113+
'
114114
done
115115

116116
for p in NA AA Z/NA Z/AA
117117
do
118118
echo This is added $p in the branch B. >$p
119-
test_expect_success \
120-
'change in branch B (addition)' \
121-
"git update-index --add $p"
119+
test_expect_success 'change in branch B (addition)' '
120+
git update-index --add $p
121+
'
122122
done
123123
echo This is SS from the modified tree. >SS
124124
echo This is LL from the modified tree. >LL
125-
test_expect_success \
126-
'change in branch B (addition and modification)' \
127-
'git update-index --add LL &&
128-
git update-index SS'
125+
test_expect_success 'change in branch B (addition and modification)' '
126+
git update-index --add LL &&
127+
git update-index SS
128+
'
129129
mv TT TT-
130130
sed -e '/Branch B/s/word/WORD/g' <TT- >TT
131131
rm -f TT-
132-
test_expect_success \
133-
'change in branch B (modification)' \
134-
'git update-index TT'
132+
test_expect_success 'change in branch B (modification)' '
133+
git update-index TT
134+
'
135135

136136
echo Branch B makes a file at DF. >DF
137-
test_expect_success \
138-
'change in branch B (addition of a file to conflict with directory)' \
139-
'git update-index --add DF'
140-
141-
test_expect_success \
142-
'recording branch B tree' \
143-
'tree_B=$(git write-tree)'
144-
145-
test_expect_success \
146-
'keep contents of 3 trees for easy access' \
147-
'rm -f .git/index &&
148-
git read-tree $tree_O &&
149-
mkdir .orig-O &&
150-
git checkout-index --prefix=.orig-O/ -f -q -a &&
151-
rm -f .git/index &&
152-
git read-tree $tree_A &&
153-
mkdir .orig-A &&
154-
git checkout-index --prefix=.orig-A/ -f -q -a &&
155-
rm -f .git/index &&
156-
git read-tree $tree_B &&
157-
mkdir .orig-B &&
158-
git checkout-index --prefix=.orig-B/ -f -q -a'
137+
test_expect_success 'change in branch B (addition of a file to conflict with directory)' '
138+
git update-index --add DF
139+
'
140+
141+
test_expect_success 'recording branch B tree' '
142+
tree_B=$(git write-tree)
143+
'
144+
145+
test_expect_success 'keep contents of 3 trees for easy access' '
146+
rm -f .git/index &&
147+
git read-tree $tree_O &&
148+
mkdir .orig-O &&
149+
git checkout-index --prefix=.orig-O/ -f -q -a &&
150+
rm -f .git/index &&
151+
git read-tree $tree_A &&
152+
mkdir .orig-A &&
153+
git checkout-index --prefix=.orig-A/ -f -q -a &&
154+
rm -f .git/index &&
155+
git read-tree $tree_B &&
156+
mkdir .orig-B &&
157+
git checkout-index --prefix=.orig-B/ -f -q -a
158+
'

0 commit comments

Comments
 (0)