Skip to content

Commit 74f172e

Browse files
committed
Merge branch 'en/test-cleanup'
Test fixes. * en/test-cleanup: t6022, t6046: fix flaky files-are-updated checks
2 parents e96327c + 70e2418 commit 74f172e

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

t/t6022-merge-rename.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ test_expect_success 'merge of identical changes in a renamed file' '
243243
git reset --hard &&
244244
git checkout change+rename &&
245245
246-
test-tool chmtime =31337 B &&
247-
test-tool chmtime --get B >old-mtime &&
246+
test-tool chmtime --get -3600 B >old-mtime &&
248247
GIT_MERGE_VERBOSITY=3 git merge change >out &&
249248
250249
test-tool chmtime --get B >new-mtime &&
@@ -253,10 +252,12 @@ test_expect_success 'merge of identical changes in a renamed file' '
253252
git reset --hard HEAD^ &&
254253
git checkout change &&
255254
256-
test-tool chmtime =-1 M &&
257-
test-tool chmtime --get M >old-mtime &&
255+
# A will be renamed to B; we check mtimes and file presence
256+
test_path_is_missing B &&
257+
test-tool chmtime --get -3600 A >old-mtime &&
258258
GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&
259259
260+
test_path_is_missing A &&
260261
test-tool chmtime --get B >new-mtime &&
261262
test $(cat old-mtime) -lt $(cat new-mtime)
262263
'
@@ -645,7 +646,7 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '
645646

646647
test_expect_success 'avoid unnecessary update, normal rename' '
647648
git checkout -q avoid-unnecessary-update-1^0 &&
648-
test-tool chmtime --get =1000000000 rename >expect &&
649+
test-tool chmtime --get -3600 rename >expect &&
649650
git merge merge-branch-1 &&
650651
test-tool chmtime --get rename >actual &&
651652
test_cmp expect actual # "rename" should have stayed intact
@@ -677,7 +678,7 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic
677678

678679
test_expect_success 'avoid unnecessary update, with D/F conflict' '
679680
git checkout -q avoid-unnecessary-update-2^0 &&
680-
test-tool chmtime --get =1000000000 df >expect &&
681+
test-tool chmtime --get -3600 df >expect &&
681682
git merge merge-branch-2 &&
682683
test-tool chmtime --get df >actual &&
683684
test_cmp expect actual # "df" should have stayed intact
@@ -708,7 +709,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
708709

709710
test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
710711
git checkout -q master^0 &&
711-
test-tool chmtime --get =1000000000 df >expect &&
712+
test-tool chmtime --get -3600 df >expect &&
712713
git merge side &&
713714
test-tool chmtime --get df >actual &&
714715
test_cmp expect actual # "df" should have stayed intact
@@ -737,7 +738,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
737738

738739
test_expect_success 'avoid unnecessary update, modify/delete' '
739740
git checkout -q master^0 &&
740-
test-tool chmtime --get =1000000000 file >expect &&
741+
test-tool chmtime --get -3600 file >expect &&
741742
test_must_fail git merge side &&
742743
test-tool chmtime --get file >actual &&
743744
test_cmp expect actual # "file" should have stayed intact
@@ -765,7 +766,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
765766

766767
test_expect_success 'avoid unnecessary update, rename/add-dest' '
767768
git checkout -q master^0 &&
768-
test-tool chmtime --get =1000000000 newfile >expect &&
769+
test-tool chmtime --get -3600 newfile >expect &&
769770
git merge side &&
770771
test-tool chmtime --get newfile >actual &&
771772
test_cmp expect actual # "file" should have stayed intact

t/t6046-merge-skip-unneeded-updates.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '
7171
7272
git checkout A^0 &&
7373
74-
test-tool chmtime =-1 b &&
75-
test-tool chmtime --get b >old-mtime &&
74+
test-tool chmtime --get -3600 b >old-mtime &&
7675
7776
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
7877
@@ -102,8 +101,7 @@ test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '
102101
103102
git checkout B^0 &&
104103
105-
test-tool chmtime =-1 b &&
106-
test-tool chmtime --get b >old-mtime &&
104+
test-tool chmtime --get -3600 b >old-mtime &&
107105
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
108106
109107
# Make sure b WAS updated
@@ -198,8 +196,7 @@ test_expect_success '2a-R: Modify/rename, merge into rename side' '
198196
199197
git checkout B^0 &&
200198
201-
test-tool chmtime =-1 c &&
202-
test-tool chmtime --get c >old-mtime &&
199+
test-tool chmtime --get -3600 c >old-mtime &&
203200
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
204201
205202
# Make sure c WAS updated
@@ -266,8 +263,7 @@ test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
266263
267264
git checkout A^0 &&
268265
269-
test-tool chmtime =-1 c &&
270-
test-tool chmtime --get c >old-mtime &&
266+
test-tool chmtime --get -3600 c >old-mtime &&
271267
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
272268
273269
test_must_be_empty err &&
@@ -373,8 +369,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
373369
374370
git checkout A^0 &&
375371
376-
test-tool chmtime =-1 c &&
377-
test-tool chmtime --get c >old-mtime &&
372+
test-tool chmtime --get -3600 c >old-mtime &&
378373
GIT_MERGE_VERBOSITY=3 &&
379374
export GIT_MERGE_VERBOSITY &&
380375
test_must_fail git merge -s recursive B^0 >out 2>err &&
@@ -679,8 +674,7 @@ test_expect_failure '4a: Change on A, change on B subset of A, dirty mods presen
679674
git checkout A^0 &&
680675
echo "File rewritten" >b &&
681676
682-
test-tool chmtime =-1 b &&
683-
test-tool chmtime --get b >old-mtime &&
677+
test-tool chmtime --get -3600 b >old-mtime &&
684678
685679
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
686680
@@ -747,8 +741,7 @@ test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mo
747741
git checkout A^0 &&
748742
echo "File rewritten" >c &&
749743
750-
test-tool chmtime =-1 c &&
751-
test-tool chmtime --get c >old-mtime &&
744+
test-tool chmtime --get -3600 c >old-mtime &&
752745
753746
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
754747

0 commit comments

Comments
 (0)