@matheusbsbs / matheus-bagliano / commits / 9f697ded88
Fork 0

t6022, t6046: test expected behavior instead of testing a proxy for it

In t6022, we were testing for file being overwritten (or not) based on an output message instead of checking for the file being overwritten. Since we can check for the file being overwritten via mtime updates, check that instead. In t6046, we were largely checking for both the expected behavior and a proxy for it, which is unnecessary. The calls to test-tool also were a bit cryptic. Make them a little clearer. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Feb 27, 2020 at 00:14 UTC 9f697ded88286804683ab2988abed23b4c63f530
2 files changed +70 -34
t/t6022-merge-rename.sh
+13 -2
@@ -242,12 +242,23 @@ test_expect_success 'merge of identical changes in a renamed file' '
242 rm -f A M N &&
243 git reset --hard &&
244 git checkout change+rename &&
245 +
246 + test-tool chmtime =31337 B &&
247 + test-tool chmtime --get B >old-mtime &&
248 GIT_MERGE_VERBOSITY=3 git merge change >out &&
246 - test_i18ngrep "^Skipped B" out &&
249 +
250 + test-tool chmtime --get B >new-mtime &&
251 + test_cmp old-mtime new-mtime &&
252 +
253 git reset --hard HEAD^ &&
254 git checkout change &&
255 +
256 + test-tool chmtime =-1 M &&
257 + test-tool chmtime --get M >old-mtime &&
258 GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&
250 - test_i18ngrep ! "^Skipped B" out
259 +
260 + test-tool chmtime --get B >new-mtime &&
261 + test $(cat old-mtime) -lt $(cat new-mtime)
262 '
263
264 test_expect_success 'setup for rename + d/f conflicts' '
t/t6046-merge-skip-unneeded-updates.sh
+57 -32
@@ -71,16 +71,16 @@ test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '
71
72 git checkout A^0 &&
73
74 - test-tool chmtime =31337 b &&
75 - test-tool chmtime -v +0 b >expected-mtime &&
74 + test-tool chmtime =-1 b &&
75 + test-tool chmtime --get b >old-mtime &&
76
77 GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
78
79 - test_i18ngrep "Skipped b" out &&
79 test_must_be_empty err &&
80
82 - test-tool chmtime -v +0 b >actual-mtime &&
83 - test_cmp expected-mtime actual-mtime &&
81 + # Make sure b was NOT updated
82 + test-tool chmtime --get b >new-mtime &&
83 + test_cmp old-mtime new-mtime &&
84
85 git ls-files -s >index_files &&
86 test_line_count = 1 index_files &&
@@ -102,9 +102,14 @@ test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '
102
103 git checkout B^0 &&
104
105 + test-tool chmtime =-1 b &&
106 + test-tool chmtime --get b >old-mtime &&
107 GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
108
107 - test_i18ngrep "Auto-merging b" out &&
109 + # Make sure b WAS updated
110 + test-tool chmtime --get b >new-mtime &&
111 + test $(cat old-mtime) -lt $(cat new-mtime) &&
112 +
113 test_must_be_empty err &&
114
115 git ls-files -s >index_files &&
@@ -165,10 +170,10 @@ test_expect_success '2a-L: Modify/rename, merge into modify side' '
170
171 git checkout A^0 &&
172
173 + test_path_is_missing c &&
174 GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
175
170 - test_i18ngrep ! "Skipped c" out &&
171 - test_must_be_empty err &&
176 + test_path_is_file c &&
177
178 git ls-files -s >index_files &&
179 test_line_count = 1 index_files &&
@@ -193,9 +198,14 @@ test_expect_success '2a-R: Modify/rename, merge into rename side' '
198
199 git checkout B^0 &&
200
201 + test-tool chmtime =-1 c &&
202 + test-tool chmtime --get c >old-mtime &&
203 GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
204
198 - test_i18ngrep ! "Skipped c" out &&
205 + # Make sure c WAS updated
206 + test-tool chmtime --get c >new-mtime &&
207 + test $(cat old-mtime) -lt $(cat new-mtime) &&
208 +
209 test_must_be_empty err &&
210
211 git ls-files -s >index_files &&
@@ -256,16 +266,15 @@ test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '
266
267 git checkout A^0 &&
268
259 - test-tool chmtime =31337 c &&
260 - test-tool chmtime -v +0 c >expected-mtime &&
261 -
269 + test-tool chmtime =-1 c &&
270 + test-tool chmtime --get c >old-mtime &&
271 GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
272
264 - test_i18ngrep "Skipped c" out &&
273 test_must_be_empty err &&
274
267 - test-tool chmtime -v +0 c >actual-mtime &&
268 - test_cmp expected-mtime actual-mtime &&
275 + # Make sure c WAS updated
276 + test-tool chmtime --get c >new-mtime &&
277 + test_cmp old-mtime new-mtime &&
278
279 git ls-files -s >index_files &&
280 test_line_count = 1 index_files &&
@@ -290,9 +299,12 @@ test_expect_success '2b-R: Rename+Mod(A)/Mod(B), B mods subset of A' '
299
300 git checkout B^0 &&
301
302 + test_path_is_missing c &&
303 GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&
304
295 - test_i18ngrep "Auto-merging c" out &&
305 + # Make sure c now present (and thus was updated)
306 + test_path_is_file c &&
307 +
308 test_must_be_empty err &&
309
310 git ls-files -s >index_files &&
@@ -361,13 +373,18 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
373
374 git checkout A^0 &&
375
376 + test-tool chmtime =-1 c &&
377 + test-tool chmtime --get c >old-mtime &&
378 GIT_MERGE_VERBOSITY=3 &&
379 export GIT_MERGE_VERBOSITY &&
380 test_must_fail git merge -s recursive B^0 >out 2>err &&
381
382 test_i18ngrep "CONFLICT (rename/add): Rename b->c" out &&
369 - test_i18ngrep ! "Skipped c" out &&
370 - test_must_be_empty err
383 + test_must_be_empty err &&
384 +
385 + # Make sure c WAS updated
386 + test-tool chmtime --get c >new-mtime &&
387 + test $(cat old-mtime) -lt $(cat new-mtime)
388
389 # FIXME: rename/add conflicts are horribly broken right now;
390 # when I get back to my patch series fixing it and
@@ -460,11 +477,13 @@ test_expect_success '3a-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
477
478 git checkout A^0 &&
479
480 + test_path_is_missing bar/bq &&
481 GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
482
465 - test_i18ngrep ! "Skipped bar/bq" out &&
483 test_must_be_empty err &&
484
485 + test_path_is_file bar/bq &&
486 +
487 git ls-files -s >index_files &&
488 test_line_count = 2 index_files &&
489
@@ -488,11 +507,13 @@ test_expect_success '3a-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
507
508 git checkout B^0 &&
509
510 + test_path_is_missing bar/bq &&
511 GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
512
493 - test_i18ngrep ! "Skipped bar/bq" out &&
513 test_must_be_empty err &&
514
515 + test_path_is_file bar/bq &&
516 +
517 git ls-files -s >index_files &&
518 test_line_count = 2 index_files &&
519
@@ -552,11 +573,13 @@ test_expect_success '3b-L: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
573
574 git checkout A^0 &&
575
576 + test_path_is_missing bar/bq &&
577 GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
578
557 - test_i18ngrep ! "Skipped bar/bq" out &&
579 test_must_be_empty err &&
580
581 + test_path_is_file bar/bq &&
582 +
583 git ls-files -s >index_files &&
584 test_line_count = 2 index_files &&
585
@@ -580,11 +603,13 @@ test_expect_success '3b-R: bq_1->foo/bq_2 on A, foo/->bar/ on B' '
603
604 git checkout B^0 &&
605
606 + test_path_is_missing bar/bq &&
607 GIT_MERGE_VERBOSITY=3 git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
608
585 - test_i18ngrep ! "Skipped bar/bq" out &&
609 test_must_be_empty err &&
610
611 + test_path_is_file bar/bq &&
612 +
613 git ls-files -s >index_files &&
614 test_line_count = 2 index_files &&
615
@@ -654,16 +679,16 @@ test_expect_failure '4a: Change on A, change on B subset of A, dirty mods presen
679 git checkout A^0 &&
680 echo "File rewritten" >b &&
681
657 - test-tool chmtime =31337 b &&
658 - test-tool chmtime -v +0 b >expected-mtime &&
682 + test-tool chmtime =-1 b &&
683 + test-tool chmtime --get b >old-mtime &&
684
685 GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
686
662 - test_i18ngrep "Skipped b" out &&
687 test_must_be_empty err &&
688
665 - test-tool chmtime -v +0 b >actual-mtime &&
666 - test_cmp expected-mtime actual-mtime &&
689 + # Make sure b was NOT updated
690 + test-tool chmtime --get b >new-mtime &&
691 + test_cmp old-mtime new-mtime &&
692
693 git ls-files -s >index_files &&
694 test_line_count = 1 index_files &&
@@ -722,16 +747,16 @@ test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mo
747 git checkout A^0 &&
748 echo "File rewritten" >c &&
749
725 - test-tool chmtime =31337 c &&
726 - test-tool chmtime -v +0 c >expected-mtime &&
750 + test-tool chmtime =-1 c &&
751 + test-tool chmtime --get c >old-mtime &&
752
753 GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&
754
730 - test_i18ngrep "Skipped c" out &&
755 test_must_be_empty err &&
756
733 - test-tool chmtime -v +0 c >actual-mtime &&
734 - test_cmp expected-mtime actual-mtime &&
757 + # Make sure c was NOT updated
758 + test-tool chmtime --get c >new-mtime &&
759 + test_cmp old-mtime new-mtime &&
760
761 git ls-files -s >index_files &&
762 test_line_count = 1 index_files &&