@@ -105,10 +105,8 @@ test_expect_success 'pull renaming branch into unrenaming one' \
105105 git show-branch &&
106106 test_expect_code 1 git pull . white &&
107107 git ls-files -s &&
108- git ls-files -u B >b.stages &&
109- test_line_count = 3 b.stages &&
110- git ls-files -s N >n.stages &&
111- test_line_count = 1 n.stages &&
108+ test_stdout_line_count = 3 git ls-files -u B &&
109+ test_stdout_line_count = 1 git ls-files -s N &&
112110 sed -ne "/^g/{
113111 p
114112 q
@@ -122,10 +120,8 @@ test_expect_success 'pull renaming branch into another renaming one' \
122120 git reset --hard &&
123121 git checkout red &&
124122 test_expect_code 1 git pull . white &&
125- git ls-files -u B >b.stages &&
126- test_line_count = 3 b.stages &&
127- git ls-files -s N >n.stages &&
128- test_line_count = 1 n.stages &&
123+ test_stdout_line_count = 3 git ls-files -u B &&
124+ test_stdout_line_count = 1 git ls-files -s N &&
129125 sed -ne "/^g/{
130126 p
131127 q
@@ -138,10 +134,8 @@ test_expect_success 'pull unrenaming branch into renaming one' \
138134 git reset --hard &&
139135 git show-branch &&
140136 test_expect_code 1 git pull . main &&
141- git ls-files -u B >b.stages &&
142- test_line_count = 3 b.stages &&
143- git ls-files -s N >n.stages &&
144- test_line_count = 1 n.stages &&
137+ test_stdout_line_count = 3 git ls-files -u B &&
138+ test_stdout_line_count = 1 git ls-files -s N &&
145139 sed -ne "/^g/{
146140 p
147141 q
@@ -154,14 +148,10 @@ test_expect_success 'pull conflicting renames' \
154148 git reset --hard &&
155149 git show-branch &&
156150 test_expect_code 1 git pull . blue &&
157- git ls-files -u A >a.stages &&
158- test_line_count = 1 a.stages &&
159- git ls-files -u B >b.stages &&
160- test_line_count = 1 b.stages &&
161- git ls-files -u C >c.stages &&
162- test_line_count = 1 c.stages &&
163- git ls-files -s N >n.stages &&
164- test_line_count = 1 n.stages &&
151+ test_stdout_line_count = 1 git ls-files -u A &&
152+ test_stdout_line_count = 1 git ls-files -u B &&
153+ test_stdout_line_count = 1 git ls-files -u C &&
154+ test_stdout_line_count = 1 git ls-files -s N &&
165155 sed -ne "/^g/{
166156 p
167157 q
@@ -330,8 +320,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
330320 test_i18ngrep "Adding as dir~HEAD instead" output
331321 fi &&
332322
333- test 3 -eq "$( git ls-files -u | wc -l)" &&
334- test 2 -eq "$( git ls-files -u dir/file-in-the-way | wc -l)" &&
323+ test_stdout_line_count = 3 git ls-files -u &&
324+ test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
335325
336326 test_must_fail git diff --quiet &&
337327 test_must_fail git diff --cached --quiet &&
@@ -357,8 +347,8 @@ test_expect_success 'Same as previous, but merged other way' '
357347 test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output
358348 fi &&
359349
360- test 3 -eq "$( git ls-files -u | wc -l)" &&
361- test 2 -eq "$( git ls-files -u dir/file-in-the-way | wc -l)" &&
350+ test_stdout_line_count = 3 git ls-files -u &&
351+ test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
362352
363353 test_must_fail git diff --quiet &&
364354 test_must_fail git diff --cached --quiet &&
@@ -374,8 +364,8 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge, dir not in
374364 git checkout -q renamed-file-has-conflicts^0 &&
375365 test_must_fail git merge --strategy=recursive dir-not-in-way &&
376366
377- test 3 -eq "$( git ls-files -u | wc -l)" &&
378- test 3 -eq "$( git ls-files -u dir | wc -l)" &&
367+ test_stdout_line_count = 3 git ls-files -u &&
368+ test_stdout_line_count = 3 git ls-files -u dir &&
379369
380370 test_must_fail git diff --quiet &&
381371 test_must_fail git diff --cached --quiet &&
@@ -409,14 +399,16 @@ test_expect_success 'Rename+D/F conflict; renamed file cannot merge and dir in t
409399 git checkout -q renamed-file-has-conflicts^0 &&
410400 test_must_fail git merge --strategy=recursive dir-in-way &&
411401
412- test 5 -eq "$( git ls-files -u | wc -l)" &&
402+ test_stdout_line_count = 5 git ls-files -u &&
413403 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
414404 then
415- test 3 -eq "$( git ls-files -u dir~HEAD | wc -l)"
405+ test_stdout_line_count = 3 git ls-files -u dir~HEAD
416406 else
417- test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)"
407+ git ls-files -u dir >out &&
408+ test 3 -eq $(grep -v file-in-the-way out | wc -l) &&
409+ rm -f out
418410 fi &&
419- test 2 -eq "$( git ls-files -u dir/file-in-the-way | wc -l)" &&
411+ test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
420412
421413 test_must_fail git diff --quiet &&
422414 test_must_fail git diff --cached --quiet &&
@@ -432,14 +424,16 @@ test_expect_success 'Same as previous, but merged other way' '
432424 git checkout -q dir-in-way^0 &&
433425 test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
434426
435- test 5 -eq "$( git ls-files -u | wc -l)" &&
427+ test_stdout_line_count = 5 git ls-files -u &&
436428 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
437429 then
438- test 3 -eq "$( git ls-files -u dir~renamed-file-has-conflicts | wc -l)"
430+ test_stdout_line_count = 3 git ls-files -u dir~renamed-file-has-conflicts
439431 else
440- test 3 -eq "$(git ls-files -u dir | grep -v file-in-the-way | wc -l)"
432+ git ls-files -u dir >out &&
433+ test 3 -eq $(grep -v file-in-the-way out | wc -l) &&
434+ rm -f out
441435 fi &&
442- test 2 -eq "$( git ls-files -u dir/file-in-the-way | wc -l)" &&
436+ test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
443437
444438 test_must_fail git diff --quiet &&
445439 test_must_fail git diff --cached --quiet &&
@@ -496,9 +490,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict
496490
497491 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
498492 then
499- test 2 -eq "$( git ls-files -u | wc -l)"
493+ test_stdout_line_count = 2 git ls-files -u
500494 else
501- test 1 -eq "$( git ls-files -u | wc -l)"
495+ test_stdout_line_count = 1 git ls-files -u
502496 fi &&
503497
504498 test_must_fail git diff --quiet &&
540534 mkdir one &&
541535 test_must_fail git merge --strategy=recursive rename-two &&
542536
543- test 4 -eq "$( git ls-files -u | wc -l)" &&
544- test 2 -eq "$( git ls-files -u one | wc -l)" &&
545- test 2 -eq "$( git ls-files -u two | wc -l)" &&
537+ test_stdout_line_count = 4 git ls-files -u &&
538+ test_stdout_line_count = 2 git ls-files -u one &&
539+ test_stdout_line_count = 2 git ls-files -u two &&
546540
547541 test_must_fail git diff --quiet &&
548542
559553 mkdir one &&
560554 test_must_fail git merge --strategy=recursive rename-two &&
561555
562- test 2 -eq "$( git ls-files -u | wc -l)" &&
563- test 1 -eq "$( git ls-files -u one | wc -l)" &&
564- test 1 -eq "$( git ls-files -u two | wc -l)" &&
556+ test_stdout_line_count = 2 git ls-files -u &&
557+ test_stdout_line_count = 1 git ls-files -u one &&
558+ test_stdout_line_count = 1 git ls-files -u two &&
565559
566560 test_must_fail git diff --quiet &&
567561
@@ -582,13 +576,13 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta
582576
583577 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
584578 then
585- test 4 -eq "$( git ls-files -u | wc -l)" &&
586- test 2 -eq "$( git ls-files -u one | wc -l)" &&
587- test 2 -eq "$( git ls-files -u two | wc -l)"
579+ test_stdout_line_count = 4 git ls-files -u &&
580+ test_stdout_line_count = 2 git ls-files -u one &&
581+ test_stdout_line_count = 2 git ls-files -u two
588582 else
589- test 2 -eq "$( git ls-files -u | wc -l)" &&
590- test 1 -eq "$( git ls-files -u one | wc -l)" &&
591- test 1 -eq "$( git ls-files -u two | wc -l)"
583+ test_stdout_line_count = 2 git ls-files -u &&
584+ test_stdout_line_count = 1 git ls-files -u one &&
585+ test_stdout_line_count = 1 git ls-files -u two
592586 fi &&
593587
594588 test_must_fail git diff --quiet &&
@@ -631,19 +625,19 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
631625
632626 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
633627 then
634- test 5 -eq "$( git ls-files -s | wc -l)" &&
635- test 3 -eq "$( git ls-files -u | wc -l)" &&
636- test 1 -eq "$( git ls-files -u one~HEAD | wc -l)" &&
637- test 1 -eq "$( git ls-files -u two~second-rename | wc -l)" &&
638- test 1 -eq "$( git ls-files -u original | wc -l)" &&
639- test 0 -eq "$( git ls-files -o | wc -l)"
628+ test_stdout_line_count = 5 git ls-files -s &&
629+ test_stdout_line_count = 3 git ls-files -u &&
630+ test_stdout_line_count = 1 git ls-files -u one~HEAD &&
631+ test_stdout_line_count = 1 git ls-files -u two~second-rename &&
632+ test_stdout_line_count = 1 git ls-files -u original &&
633+ test_stdout_line_count = 0 git ls-files -o
640634 else
641- test 5 -eq "$( git ls-files -s | wc -l)" &&
642- test 3 -eq "$( git ls-files -u | wc -l)" &&
643- test 1 -eq "$( git ls-files -u one | wc -l)" &&
644- test 1 -eq "$( git ls-files -u two | wc -l)" &&
645- test 1 -eq "$( git ls-files -u original | wc -l)" &&
646- test 2 -eq "$( git ls-files -o | wc -l)"
635+ test_stdout_line_count = 5 git ls-files -s &&
636+ test_stdout_line_count = 3 git ls-files -u &&
637+ test_stdout_line_count = 1 git ls-files -u one &&
638+ test_stdout_line_count = 1 git ls-files -u two &&
639+ test_stdout_line_count = 1 git ls-files -u original &&
640+ test_stdout_line_count = 2 git ls-files -o
647641 fi &&
648642
649643 test_path_is_file one/file &&
@@ -679,11 +673,11 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
679673 git checkout -q first-rename-redo^0 &&
680674 test_must_fail git merge --strategy=recursive second-rename-redo &&
681675
682- test 3 -eq "$( git ls-files -u | wc -l)" &&
683- test 1 -eq "$( git ls-files -u one | wc -l)" &&
684- test 1 -eq "$( git ls-files -u two | wc -l)" &&
685- test 1 -eq "$( git ls-files -u original | wc -l)" &&
686- test 0 -eq "$( git ls-files -o | wc -l)" &&
676+ test_stdout_line_count = 3 git ls-files -u &&
677+ test_stdout_line_count = 1 git ls-files -u one &&
678+ test_stdout_line_count = 1 git ls-files -u two &&
679+ test_stdout_line_count = 1 git ls-files -u original &&
680+ test_stdout_line_count = 0 git ls-files -o &&
687681
688682 test_path_is_file one &&
689683 test_path_is_file two &&
@@ -861,9 +855,11 @@ test_expect_success 'setup merge of rename + small change' '
861855test_expect_success ' merge rename + small change' '
862856 git merge rename_branch &&
863857
864- test 1 -eq $(git ls-files -s | wc -l) &&
865- test 0 -eq $(git ls-files -o | wc -l) &&
866- test $(git rev-parse HEAD:renamed_file) = $(git rev-parse HEAD~1:file)
858+ test_stdout_line_count = 1 git ls-files -s &&
859+ test_stdout_line_count = 0 git ls-files -o &&
860+ newhash=$(git rev-parse HEAD:renamed_file) &&
861+ oldhash=$(git rev-parse HEAD~1:file) &&
862+ test $newhash = $oldhash
867863'
868864
869865test_expect_success ' setup for use of extended merge markers' '
0 commit comments