@@ -105,10 +105,8 @@ test_expect_success 'pull renaming branch into unrenaming one' \
105
105
git show-branch &&
106
106
test_expect_code 1 git pull . white &&
107
107
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 &&
112
110
sed -ne "/^g/{
113
111
p
114
112
q
@@ -122,10 +120,8 @@ test_expect_success 'pull renaming branch into another renaming one' \
122
120
git reset --hard &&
123
121
git checkout red &&
124
122
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 &&
129
125
sed -ne "/^g/{
130
126
p
131
127
q
@@ -138,10 +134,8 @@ test_expect_success 'pull unrenaming branch into renaming one' \
138
134
git reset --hard &&
139
135
git show-branch &&
140
136
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 &&
145
139
sed -ne "/^g/{
146
140
p
147
141
q
@@ -154,14 +148,10 @@ test_expect_success 'pull conflicting renames' \
154
148
git reset --hard &&
155
149
git show-branch &&
156
150
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 &&
165
155
sed -ne "/^g/{
166
156
p
167
157
q
@@ -330,8 +320,8 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
330
320
test_i18ngrep "Adding as dir~HEAD instead" output
331
321
fi &&
332
322
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 &&
335
325
336
326
test_must_fail git diff --quiet &&
337
327
test_must_fail git diff --cached --quiet &&
@@ -357,8 +347,8 @@ test_expect_success 'Same as previous, but merged other way' '
357
347
test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output
358
348
fi &&
359
349
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 &&
362
352
363
353
test_must_fail git diff --quiet &&
364
354
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
374
364
git checkout -q renamed-file-has-conflicts^0 &&
375
365
test_must_fail git merge --strategy=recursive dir-not-in-way &&
376
366
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 &&
379
369
380
370
test_must_fail git diff --quiet &&
381
371
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
409
399
git checkout -q renamed-file-has-conflicts^0 &&
410
400
test_must_fail git merge --strategy=recursive dir-in-way &&
411
401
412
- test 5 -eq "$( git ls-files -u | wc -l)" &&
402
+ test_stdout_line_count = 5 git ls-files -u &&
413
403
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
414
404
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
416
406
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
418
410
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 &&
420
412
421
413
test_must_fail git diff --quiet &&
422
414
test_must_fail git diff --cached --quiet &&
@@ -432,14 +424,16 @@ test_expect_success 'Same as previous, but merged other way' '
432
424
git checkout -q dir-in-way^0 &&
433
425
test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
434
426
435
- test 5 -eq "$( git ls-files -u | wc -l)" &&
427
+ test_stdout_line_count = 5 git ls-files -u &&
436
428
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
437
429
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
439
431
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
441
435
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 &&
443
437
444
438
test_must_fail git diff --quiet &&
445
439
test_must_fail git diff --cached --quiet &&
@@ -496,9 +490,9 @@ test_expect_success 'both rename source and destination involved in D/F conflict
496
490
497
491
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
498
492
then
499
- test 2 -eq "$( git ls-files -u | wc -l)"
493
+ test_stdout_line_count = 2 git ls-files -u
500
494
else
501
- test 1 -eq "$( git ls-files -u | wc -l)"
495
+ test_stdout_line_count = 1 git ls-files -u
502
496
fi &&
503
497
504
498
test_must_fail git diff --quiet &&
540
534
mkdir one &&
541
535
test_must_fail git merge --strategy=recursive rename-two &&
542
536
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 &&
546
540
547
541
test_must_fail git diff --quiet &&
548
542
559
553
mkdir one &&
560
554
test_must_fail git merge --strategy=recursive rename-two &&
561
555
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 &&
565
559
566
560
test_must_fail git diff --quiet &&
567
561
@@ -582,13 +576,13 @@ test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean sta
582
576
583
577
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
584
578
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
588
582
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
592
586
fi &&
593
587
594
588
test_must_fail git diff --quiet &&
@@ -631,19 +625,19 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
631
625
632
626
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
633
627
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
640
634
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
647
641
fi &&
648
642
649
643
test_path_is_file one/file &&
@@ -679,11 +673,11 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
679
673
git checkout -q first-rename-redo^0 &&
680
674
test_must_fail git merge --strategy=recursive second-rename-redo &&
681
675
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 &&
687
681
688
682
test_path_is_file one &&
689
683
test_path_is_file two &&
@@ -861,9 +855,11 @@ test_expect_success 'setup merge of rename + small change' '
861
855
test_expect_success ' merge rename + small change' '
862
856
git merge rename_branch &&
863
857
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
867
863
'
868
864
869
865
test_expect_success ' setup for use of extended merge markers' '
0 commit comments