Skip to content

Commit 7dac634

Browse files
john-caigitster
authored andcommitted
t9200-git-cvsexportcommit: modernize test format
Some tests still use the old format with four spaces indentation. Standardize the tests to the new format with tab indentation. Signed-off-by: John Cai <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7d7097b commit 7dac634

File tree

1 file changed

+175
-176
lines changed

1 file changed

+175
-176
lines changed

t/t9200-git-cvsexportcommit.sh

Lines changed: 175 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -50,56 +50,56 @@ check_entries () {
5050
fi
5151
}
5252

53-
test_expect_success \
54-
'New file' \
55-
'mkdir A B C D E F &&
56-
echo hello1 >A/newfile1.txt &&
57-
echo hello2 >B/newfile2.txt &&
58-
cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
59-
cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
60-
git add A/newfile1.txt &&
61-
git add B/newfile2.txt &&
62-
git add C/newfile3.png &&
63-
git add D/newfile4.png &&
64-
git commit -a -m "Test: New file" &&
65-
id=$(git rev-list --max-count=1 HEAD) &&
66-
(cd "$CVSWORK" &&
67-
git cvsexportcommit -c $id &&
68-
check_entries A "newfile1.txt/1.1/" &&
69-
check_entries B "newfile2.txt/1.1/" &&
70-
check_entries C "newfile3.png/1.1/-kb" &&
71-
check_entries D "newfile4.png/1.1/-kb" &&
72-
test_cmp A/newfile1.txt ../A/newfile1.txt &&
73-
test_cmp B/newfile2.txt ../B/newfile2.txt &&
74-
test_cmp C/newfile3.png ../C/newfile3.png &&
75-
test_cmp D/newfile4.png ../D/newfile4.png
76-
)'
53+
test_expect_success 'New file' '
54+
mkdir A B C D E F &&
55+
echo hello1 >A/newfile1.txt &&
56+
echo hello2 >B/newfile2.txt &&
57+
cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
58+
cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
59+
git add A/newfile1.txt &&
60+
git add B/newfile2.txt &&
61+
git add C/newfile3.png &&
62+
git add D/newfile4.png &&
63+
git commit -a -m "Test: New file" &&
64+
id=$(git rev-list --max-count=1 HEAD) &&
65+
(cd "$CVSWORK" &&
66+
git cvsexportcommit -c $id &&
67+
check_entries A "newfile1.txt/1.1/" &&
68+
check_entries B "newfile2.txt/1.1/" &&
69+
check_entries C "newfile3.png/1.1/-kb" &&
70+
check_entries D "newfile4.png/1.1/-kb" &&
71+
test_cmp A/newfile1.txt ../A/newfile1.txt &&
72+
test_cmp B/newfile2.txt ../B/newfile2.txt &&
73+
test_cmp C/newfile3.png ../C/newfile3.png &&
74+
test_cmp D/newfile4.png ../D/newfile4.png
75+
)
76+
'
7777

78-
test_expect_success \
79-
'Remove two files, add two and update two' \
80-
'echo Hello1 >>A/newfile1.txt &&
81-
rm -f B/newfile2.txt &&
82-
rm -f C/newfile3.png &&
83-
echo Hello5 >E/newfile5.txt &&
84-
cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
85-
cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
86-
git add E/newfile5.txt &&
87-
git add F/newfile6.png &&
88-
git commit -a -m "Test: Remove, add and update" &&
89-
id=$(git rev-list --max-count=1 HEAD) &&
90-
(cd "$CVSWORK" &&
91-
git cvsexportcommit -c $id &&
92-
check_entries A "newfile1.txt/1.2/" &&
93-
check_entries B "" &&
94-
check_entries C "" &&
95-
check_entries D "newfile4.png/1.2/-kb" &&
96-
check_entries E "newfile5.txt/1.1/" &&
97-
check_entries F "newfile6.png/1.1/-kb" &&
98-
test_cmp A/newfile1.txt ../A/newfile1.txt &&
99-
test_cmp D/newfile4.png ../D/newfile4.png &&
100-
test_cmp E/newfile5.txt ../E/newfile5.txt &&
101-
test_cmp F/newfile6.png ../F/newfile6.png
102-
)'
78+
test_expect_success 'Remove two files, add two and update two' '
79+
echo Hello1 >>A/newfile1.txt &&
80+
rm -f B/newfile2.txt &&
81+
rm -f C/newfile3.png &&
82+
echo Hello5 >E/newfile5.txt &&
83+
cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
84+
cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
85+
git add E/newfile5.txt &&
86+
git add F/newfile6.png &&
87+
git commit -a -m "Test: Remove, add and update" &&
88+
id=$(git rev-list --max-count=1 HEAD) &&
89+
(cd "$CVSWORK" &&
90+
git cvsexportcommit -c $id &&
91+
check_entries A "newfile1.txt/1.2/" &&
92+
check_entries B "" &&
93+
check_entries C "" &&
94+
check_entries D "newfile4.png/1.2/-kb" &&
95+
check_entries E "newfile5.txt/1.1/" &&
96+
check_entries F "newfile6.png/1.1/-kb" &&
97+
test_cmp A/newfile1.txt ../A/newfile1.txt &&
98+
test_cmp D/newfile4.png ../D/newfile4.png &&
99+
test_cmp E/newfile5.txt ../E/newfile5.txt &&
100+
test_cmp F/newfile6.png ../F/newfile6.png
101+
)
102+
'
103103

104104
# Should fail (but only on the git cvsexportcommit stage)
105105
test_expect_success \
@@ -129,67 +129,67 @@ test_expect_success \
129129

130130
# This test is here because a patch for only binary files will
131131
# fail with gnu patch, so cvsexportcommit must handle that.
132-
test_expect_success \
133-
'Remove only binary files' \
134-
'git reset --hard HEAD^^ &&
135-
rm -f D/newfile4.png &&
136-
git commit -a -m "test: remove only a binary file" &&
137-
id=$(git rev-list --max-count=1 HEAD) &&
138-
(cd "$CVSWORK" &&
139-
git cvsexportcommit -c $id &&
140-
check_entries A "newfile1.txt/1.2/" &&
141-
check_entries B "" &&
142-
check_entries C "" &&
143-
check_entries D "" &&
144-
check_entries E "newfile5.txt/1.1/" &&
145-
check_entries F "newfile6.png/1.1/-kb" &&
146-
test_cmp A/newfile1.txt ../A/newfile1.txt &&
147-
test_cmp E/newfile5.txt ../E/newfile5.txt &&
148-
test_cmp F/newfile6.png ../F/newfile6.png
149-
)'
132+
test_expect_success 'Remove only binary files' '
133+
git reset --hard HEAD^^ &&
134+
rm -f D/newfile4.png &&
135+
git commit -a -m "test: remove only a binary file" &&
136+
id=$(git rev-list --max-count=1 HEAD) &&
137+
(cd "$CVSWORK" &&
138+
git cvsexportcommit -c $id &&
139+
check_entries A "newfile1.txt/1.2/" &&
140+
check_entries B "" &&
141+
check_entries C "" &&
142+
check_entries D "" &&
143+
check_entries E "newfile5.txt/1.1/" &&
144+
check_entries F "newfile6.png/1.1/-kb" &&
145+
test_cmp A/newfile1.txt ../A/newfile1.txt &&
146+
test_cmp E/newfile5.txt ../E/newfile5.txt &&
147+
test_cmp F/newfile6.png ../F/newfile6.png
148+
)
149+
'
150150

151-
test_expect_success \
152-
'Remove only a text file' \
153-
'rm -f A/newfile1.txt &&
154-
git commit -a -m "test: remove only a binary file" &&
155-
id=$(git rev-list --max-count=1 HEAD) &&
156-
(cd "$CVSWORK" &&
157-
git cvsexportcommit -c $id &&
158-
check_entries A "" &&
159-
check_entries B "" &&
160-
check_entries C "" &&
161-
check_entries D "" &&
162-
check_entries E "newfile5.txt/1.1/" &&
163-
check_entries F "newfile6.png/1.1/-kb" &&
164-
test_cmp E/newfile5.txt ../E/newfile5.txt &&
165-
test_cmp F/newfile6.png ../F/newfile6.png
166-
)'
151+
test_expect_success 'Remove only a text file' '
152+
rm -f A/newfile1.txt &&
153+
git commit -a -m "test: remove only a binary file" &&
154+
id=$(git rev-list --max-count=1 HEAD) &&
155+
(cd "$CVSWORK" &&
156+
git cvsexportcommit -c $id &&
157+
check_entries A "" &&
158+
check_entries B "" &&
159+
check_entries C "" &&
160+
check_entries D "" &&
161+
check_entries E "newfile5.txt/1.1/" &&
162+
check_entries F "newfile6.png/1.1/-kb" &&
163+
test_cmp E/newfile5.txt ../E/newfile5.txt &&
164+
test_cmp F/newfile6.png ../F/newfile6.png
165+
)
166+
'
167167

168-
test_expect_success \
169-
'New file with spaces in file name' \
170-
'mkdir "G g" &&
171-
echo ok then >"G g/with spaces.txt" &&
172-
git add "G g/with spaces.txt" && \
173-
cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
174-
git add "G g/with spaces.png" &&
175-
git commit -a -m "With spaces" &&
176-
id=$(git rev-list --max-count=1 HEAD) &&
177-
(cd "$CVSWORK" &&
178-
git cvsexportcommit -c $id &&
179-
check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"
180-
)'
168+
test_expect_success 'New file with spaces in file name' '
169+
mkdir "G g" &&
170+
echo ok then >"G g/with spaces.txt" &&
171+
git add "G g/with spaces.txt" && \
172+
cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
173+
git add "G g/with spaces.png" &&
174+
git commit -a -m "With spaces" &&
175+
id=$(git rev-list --max-count=1 HEAD) &&
176+
(cd "$CVSWORK" &&
177+
git cvsexportcommit -c $id &&
178+
check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/"
179+
)
180+
'
181181

182-
test_expect_success \
183-
'Update file with spaces in file name' \
184-
'echo Ok then >>"G g/with spaces.txt" &&
185-
cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
186-
git add "G g/with spaces.png" &&
187-
git commit -a -m "Update with spaces" &&
188-
id=$(git rev-list --max-count=1 HEAD) &&
189-
(cd "$CVSWORK" &&
190-
git cvsexportcommit -c $id &&
191-
check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"
192-
)'
182+
test_expect_success 'Update file with spaces in file name' '
183+
echo Ok then >>"G g/with spaces.txt" &&
184+
cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
185+
git add "G g/with spaces.png" &&
186+
git commit -a -m "Update with spaces" &&
187+
id=$(git rev-list --max-count=1 HEAD) &&
188+
(cd "$CVSWORK" &&
189+
git cvsexportcommit -c $id &&
190+
check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/"
191+
)
192+
'
193193

194194
# Some filesystems mangle pathnames with UTF-8 characters --
195195
# check and skip
@@ -202,68 +202,68 @@ if p="Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" &&
202202
then
203203

204204
# This test contains UTF-8 characters
205-
test_expect_success !MINGW \
206-
'File with non-ascii file name' \
207-
'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
208-
echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
209-
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
210-
cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
211-
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
212-
git commit -a -m "Går det så går det" && \
213-
id=$(git rev-list --max-count=1 HEAD) &&
214-
(cd "$CVSWORK" &&
215-
git cvsexportcommit -v -c $id &&
216-
check_entries \
217-
"Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \
218-
"gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/"
219-
)'
205+
test_expect_success !MINGW 'File with non-ascii file name' '
206+
mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
207+
echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
208+
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
209+
cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
210+
git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
211+
git commit -a -m "Går det så går det" && \
212+
id=$(git rev-list --max-count=1 HEAD) &&
213+
(cd "$CVSWORK" &&
214+
git cvsexportcommit -v -c $id &&
215+
check_entries \
216+
"Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \
217+
"gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/"
218+
)
219+
'
220220

221221
fi
222222

223223
rm -fr tst
224224

225-
test_expect_success \
226-
'Mismatching patch should fail' \
227-
'date >>"E/newfile5.txt" &&
228-
git add "E/newfile5.txt" &&
229-
git commit -a -m "Update one" &&
230-
date >>"E/newfile5.txt" &&
231-
git add "E/newfile5.txt" &&
232-
git commit -a -m "Update two" &&
233-
id=$(git rev-list --max-count=1 HEAD) &&
234-
(cd "$CVSWORK" &&
235-
test_must_fail git cvsexportcommit -c $id
236-
)'
237-
238-
test_expect_success FILEMODE \
239-
'Retain execute bit' \
240-
'mkdir G &&
241-
echo executeon >G/on &&
242-
chmod +x G/on &&
243-
echo executeoff >G/off &&
244-
git add G/on &&
245-
git add G/off &&
246-
git commit -a -m "Execute test" &&
247-
(cd "$CVSWORK" &&
248-
git cvsexportcommit -c HEAD &&
249-
test -x G/on &&
250-
! test -x G/off
251-
)'
225+
test_expect_success 'Mismatching patch should fail' '
226+
date >>"E/newfile5.txt" &&
227+
git add "E/newfile5.txt" &&
228+
git commit -a -m "Update one" &&
229+
date >>"E/newfile5.txt" &&
230+
git add "E/newfile5.txt" &&
231+
git commit -a -m "Update two" &&
232+
id=$(git rev-list --max-count=1 HEAD) &&
233+
(cd "$CVSWORK" &&
234+
test_must_fail git cvsexportcommit -c $id
235+
)
236+
'
237+
238+
test_expect_success FILEMODE 'Retain execute bit' '
239+
mkdir G &&
240+
echo executeon >G/on &&
241+
chmod +x G/on &&
242+
echo executeoff >G/off &&
243+
git add G/on &&
244+
git add G/off &&
245+
git commit -a -m "Execute test" &&
246+
(cd "$CVSWORK" &&
247+
git cvsexportcommit -c HEAD &&
248+
test -x G/on &&
249+
! test -x G/off
250+
)
251+
'
252252

253253
test_expect_success '-w option should work with relative GIT_DIR' '
254-
mkdir W &&
255-
echo foobar >W/file1.txt &&
256-
echo bazzle >W/file2.txt &&
257-
git add W/file1.txt &&
258-
git add W/file2.txt &&
259-
git commit -m "More updates" &&
260-
id=$(git rev-list --max-count=1 HEAD) &&
261-
(cd "$GIT_DIR" &&
262-
GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&
263-
check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&
264-
test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&
265-
test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt
266-
)
254+
mkdir W &&
255+
echo foobar >W/file1.txt &&
256+
echo bazzle >W/file2.txt &&
257+
git add W/file1.txt &&
258+
git add W/file2.txt &&
259+
git commit -m "More updates" &&
260+
id=$(git rev-list --max-count=1 HEAD) &&
261+
(cd "$GIT_DIR" &&
262+
GIT_DIR=. git cvsexportcommit -w "$CVSWORK" -c $id &&
263+
check_entries "$CVSWORK/W" "file1.txt/1.1/|file2.txt/1.1/" &&
264+
test_cmp "$CVSWORK/W/file1.txt" ../W/file1.txt &&
265+
test_cmp "$CVSWORK/W/file2.txt" ../W/file2.txt
266+
)
267267
'
268268

269269
test_expect_success 'check files before directories' '
@@ -290,21 +290,20 @@ test_expect_success 'check files before directories' '
290290
'
291291

292292
test_expect_success 're-commit a removed filename which remains in CVS attic' '
293-
294-
(cd "$CVSWORK" &&
295-
echo >attic_gremlin &&
296-
cvs -Q add attic_gremlin &&
297-
cvs -Q ci -m "added attic_gremlin" &&
298-
rm attic_gremlin &&
299-
cvs -Q rm attic_gremlin &&
300-
cvs -Q ci -m "removed attic_gremlin") &&
301-
302-
echo > attic_gremlin &&
303-
git add attic_gremlin &&
304-
git commit -m "Added attic_gremlin" &&
293+
(cd "$CVSWORK" &&
294+
echo >attic_gremlin &&
295+
cvs -Q add attic_gremlin &&
296+
cvs -Q ci -m "added attic_gremlin" &&
297+
rm attic_gremlin &&
298+
cvs -Q rm attic_gremlin &&
299+
cvs -Q ci -m "removed attic_gremlin") &&
300+
301+
echo > attic_gremlin &&
302+
git add attic_gremlin &&
303+
git commit -m "Added attic_gremlin" &&
305304
git cvsexportcommit -w "$CVSWORK" -c HEAD &&
306-
(cd "$CVSWORK" && cvs -Q update -d) &&
307-
test -f "$CVSWORK/attic_gremlin"
305+
(cd "$CVSWORK" && cvs -Q update -d) &&
306+
test -f "$CVSWORK/attic_gremlin"
308307
'
309308

310309
# the state of the CVS sandbox may be indeterminate for ' space'

0 commit comments

Comments
 (0)