Skip to content

Commit 25b226b

Browse files
committed
t9390: make tests individually re-runnable
Signed-off-by: Elijah Newren <[email protected]>
1 parent eb9ea17 commit 25b226b

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

t/t9390-filter-repo.sh

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ filter_testcase degenerate degenerate-keepme-noff --path moduleA/keepme --no-ff
5151
filter_testcase unusual unusual-filtered --path ''
5252
filter_testcase unusual unusual-mailmap --mailmap ../t9390/sample-mailmap
5353

54-
test_expect_success 'setup path_rename' '
54+
setup_path_rename() {
55+
test -d path_rename && return
5556
test_create_repo path_rename &&
5657
(
5758
cd path_rename &&
@@ -79,9 +80,10 @@ test_expect_success 'setup path_rename' '
7980
git add sequences/medium &&
8081
git commit -m final
8182
)
82-
'
83+
}
8384

8485
test_expect_success '--path-rename sequences/tiny:sequences/small' '
86+
setup_path_rename &&
8587
(
8688
git clone file://"$(pwd)"/path_rename path_rename_single &&
8789
cd path_rename_single &&
@@ -94,6 +96,7 @@ test_expect_success '--path-rename sequences/tiny:sequences/small' '
9496
'
9597

9698
test_expect_success '--path-rename sequences:numbers' '
99+
setup_path_rename &&
97100
(
98101
git clone file://"$(pwd)"/path_rename path_rename_dir &&
99102
cd path_rename_dir &&
@@ -107,6 +110,7 @@ test_expect_success '--path-rename sequences:numbers' '
107110
'
108111

109112
test_expect_success '--path-rename-prefix values:numbers' '
113+
setup_path_rename &&
110114
(
111115
git clone file://"$(pwd)"/path_rename path_rename_dir_2 &&
112116
cd path_rename_dir_2 &&
@@ -120,6 +124,7 @@ test_expect_success '--path-rename-prefix values:numbers' '
120124
'
121125

122126
test_expect_success '--path-rename squashing' '
127+
setup_path_rename &&
123128
(
124129
git clone file://"$(pwd)"/path_rename path_rename_squash &&
125130
cd path_rename_squash &&
@@ -138,6 +143,7 @@ test_expect_success '--path-rename squashing' '
138143
'
139144

140145
test_expect_success '--path-rename inability to squash' '
146+
setup_path_rename &&
141147
(
142148
git clone file://"$(pwd)"/path_rename path_rename_bad_squash &&
143149
cd path_rename_bad_squash &&
@@ -149,6 +155,7 @@ test_expect_success '--path-rename inability to squash' '
149155
'
150156

151157
test_expect_success '--paths-from-file' '
158+
setup_path_rename &&
152159
(
153160
git clone file://"$(pwd)"/path_rename paths_from_file &&
154161
cd paths_from_file &&
@@ -257,7 +264,8 @@ test_expect_success 'Mixing filtering and to-subdirectory-filter' '
257264
)
258265
'
259266

260-
test_expect_success 'setup metasyntactic repo' '
267+
setup_metasyntactic_repo() {
268+
test -d metasyntactic && return
261269
test_create_repo metasyntactic &&
262270
(
263271
cd metasyntactic &&
@@ -287,9 +295,10 @@ test_expect_success 'setup metasyntactic repo' '
287295
git commit -m more.words &&
288296
git tag -a -m "Look, ma, I made a tag" v3.0
289297
)
290-
'
298+
}
291299

292300
test_expect_success '--tag-rename' '
301+
setup_metasyntactic_repo &&
293302
(
294303
git clone file://"$(pwd)"/metasyntactic tag_rename &&
295304
cd tag_rename &&
@@ -308,6 +317,7 @@ test_expect_success '--tag-rename' '
308317
'
309318

310319
test_expect_success '--subdirectory-filter' '
320+
setup_metasyntactic_repo &&
311321
(
312322
git clone file://"$(pwd)"/metasyntactic subdir_filter &&
313323
cd subdir_filter &&
@@ -326,6 +336,7 @@ test_expect_success '--subdirectory-filter' '
326336
'
327337

328338
test_expect_success '--subdirectory-filter with trailing slash' '
339+
setup_metasyntactic_repo &&
329340
(
330341
git clone file://"$(pwd)"/metasyntactic subdir_filter_2 &&
331342
cd subdir_filter_2 &&
@@ -344,6 +355,7 @@ test_expect_success '--subdirectory-filter with trailing slash' '
344355
'
345356

346357
test_expect_success '--to-subdirectory-filter' '
358+
setup_metasyntactic_repo &&
347359
(
348360
git clone file://"$(pwd)"/metasyntactic to_subdir_filter &&
349361
cd to_subdir_filter &&
@@ -363,6 +375,7 @@ test_expect_success '--to-subdirectory-filter' '
363375
'
364376

365377
test_expect_success '--use-base-name' '
378+
setup_metasyntactic_repo &&
366379
(
367380
git clone file://"$(pwd)"/metasyntactic use_base_name &&
368381
cd use_base_name &&
@@ -381,6 +394,7 @@ test_expect_success '--use-base-name' '
381394
'
382395

383396
test_expect_success 'refs/replace/ to skip a parent' '
397+
setup_metasyntactic_repo &&
384398
(
385399
git clone file://"$(pwd)"/metasyntactic replace_skip_ref &&
386400
cd replace_skip_ref &&
@@ -402,6 +416,7 @@ test_expect_success 'refs/replace/ to skip a parent' '
402416
'
403417

404418
test_expect_success 'refs/replace/ to add more initial history' '
419+
setup_metasyntactic_repo &&
405420
(
406421
git clone file://"$(pwd)"/metasyntactic replace_add_refs &&
407422
cd replace_add_refs &&
@@ -436,6 +451,7 @@ test_expect_success 'refs/replace/ to add more initial history' '
436451
'
437452

438453
test_expect_success 'creation/deletion/updating of replace refs' '
454+
setup_metasyntactic_repo &&
439455
(
440456
git clone file://"$(pwd)"/metasyntactic replace_handling &&
441457
@@ -494,6 +510,7 @@ test_expect_success 'creation/deletion/updating of replace refs' '
494510
'
495511

496512
test_expect_success '--debug' '
513+
setup_metasyntactic_repo &&
497514
(
498515
git clone file://"$(pwd)"/metasyntactic debug &&
499516
cd debug &&
@@ -516,6 +533,7 @@ test_expect_success '--debug' '
516533
'
517534

518535
test_expect_success '--dry-run' '
536+
setup_metasyntactic_repo &&
519537
(
520538
git clone file://"$(pwd)"/metasyntactic dry_run &&
521539
cd dry_run &&
@@ -543,6 +561,7 @@ test_expect_success '--dry-run' '
543561
'
544562

545563
test_expect_success '--dry-run --debug' '
564+
setup_metasyntactic_repo &&
546565
(
547566
git clone file://"$(pwd)"/metasyntactic dry_run_debug &&
548567
cd dry_run_debug &&
@@ -570,6 +589,7 @@ test_expect_success '--dry-run --debug' '
570589
'
571590

572591
test_expect_success '--dry-run --stdin' '
592+
setup_metasyntactic_repo &&
573593
(
574594
git clone file://"$(pwd)"/metasyntactic dry_run_stdin &&
575595
cd dry_run_stdin &&
@@ -594,7 +614,8 @@ test_expect_success '--dry-run --stdin' '
594614
)
595615
'
596616

597-
test_expect_success 'setup analyze_me' '
617+
setup_analyze_me() {
618+
test -d analyze_me && return
598619
test_create_repo analyze_me &&
599620
(
600621
cd analyze_me &&
@@ -666,9 +687,10 @@ test_expect_success 'setup analyze_me' '
666687
# Add a random extra unreferenced object
667688
echo foobar | git hash-object --stdin -w
668689
)
669-
'
690+
}
670691

671692
test_expect_success C_LOCALE_OUTPUT '--analyze' '
693+
setup_analyze_me &&
672694
(
673695
cd analyze_me &&
674696
@@ -777,6 +799,7 @@ test_expect_success C_LOCALE_OUTPUT '--analyze' '
777799
'
778800

779801
test_expect_success '--replace-text all options' '
802+
setup_analyze_me &&
780803
(
781804
git clone file://"$(pwd)"/analyze_me replace_text &&
782805
cd replace_text &&
@@ -801,6 +824,7 @@ test_expect_success '--replace-text all options' '
801824
'
802825

803826
test_expect_success '--strip-blobs-bigger-than' '
827+
setup_analyze_me &&
804828
(
805829
git clone file://"$(pwd)"/analyze_me strip_big_blobs &&
806830
cd strip_big_blobs &&
@@ -856,6 +880,7 @@ test_expect_success '--strip-blobs-bigger-than' '
856880
'
857881

858882
test_expect_success '--strip-blobs-with-ids' '
883+
setup_analyze_me &&
859884
(
860885
git clone file://"$(pwd)"/analyze_me strip_blobs_with_ids &&
861886
cd strip_blobs_with_ids &&
@@ -900,7 +925,8 @@ test_expect_success '--strip-blobs-with-ids' '
900925
)
901926
'
902927

903-
test_expect_success 'setup commit message rewriting' '
928+
setup_commit_message_rewriting() {
929+
test -d commit_msg && return
904930
test_create_repo commit_msg &&
905931
(
906932
cd commit_msg &&
@@ -931,9 +957,10 @@ test_expect_success 'setup commit message rewriting' '
931957
git add baz &&
932958
git commit
933959
)
934-
'
960+
}
935961

936962
test_expect_success 'commit message rewrite' '
963+
setup_commit_message_rewriting &&
937964
(
938965
git clone file://"$(pwd)"/commit_msg commit_msg_clone &&
939966
cd commit_msg_clone &&
@@ -960,6 +987,7 @@ test_expect_success 'commit message rewrite' '
960987
'
961988

962989
test_expect_success 'commit hash unchanged if requested' '
990+
setup_commit_message_rewriting &&
963991
(
964992
git clone file://"$(pwd)"/commit_msg commit_msg_clone_2 &&
965993
cd commit_msg_clone_2 &&
@@ -1048,6 +1076,7 @@ test_expect_success 'commit message rewrite unsuccessful' '
10481076
'
10491077

10501078
test_expect_success 'startup sanity checks' '
1079+
setup_analyze_me &&
10511080
(
10521081
git clone file://"$(pwd)"/analyze_me startup_sanity_checks &&
10531082
cd startup_sanity_checks &&
@@ -1222,6 +1251,7 @@ test_expect_success 'invalid fast-import directives' '
12221251
'
12231252

12241253
test_expect_success 'mailmap sanity checks' '
1254+
setup_analyze_me &&
12251255
(
12261256
git clone file://"$(pwd)"/analyze_me mailmap_sanity_checks &&
12271257
cd mailmap_sanity_checks &&
@@ -1244,6 +1274,7 @@ test_expect_success 'mailmap sanity checks' '
12441274
'
12451275

12461276
test_expect_success 'incremental import' '
1277+
setup_analyze_me &&
12471278
(
12481279
git clone file://"$(pwd)"/analyze_me incremental &&
12491280
cd incremental &&
@@ -1256,6 +1287,7 @@ test_expect_success 'incremental import' '
12561287
'
12571288

12581289
test_expect_success '--target' '
1290+
setup_analyze_me &&
12591291
git init target &&
12601292
(
12611293
cd target &&
@@ -1274,6 +1306,7 @@ test_expect_success '--target' '
12741306
'
12751307

12761308
test_expect_success '--refs' '
1309+
setup_analyze_me &&
12771310
git init refs &&
12781311
(
12791312
cd refs &&
@@ -1313,7 +1346,8 @@ test_expect_success 'reset to specific refs' '
13131346
)
13141347
'
13151348

1316-
test_expect_success 'setup handle funny characters' '
1349+
setup_handle_funny_characters() {
1350+
test -d funny_chars && return
13171351
test_create_repo funny_chars &&
13181352
(
13191353
cd funny_chars &&
@@ -1345,9 +1379,10 @@ test_expect_success 'setup handle funny characters' '
13451379

13461380
git tag -a -m "₪₽£€$" סְפָרַד
13471381
)
1348-
'
1382+
}
13491383

13501384
test_expect_success 'handle funny characters' '
1385+
setup_handle_funny_characters &&
13511386
(
13521387
git clone file://"$(pwd)"/funny_chars funny_chars_checks &&
13531388
cd funny_chars_checks &&

0 commit comments

Comments
 (0)