@@ -443,20 +443,20 @@ run_dir_diff_test () {
443
443
444
444
run_dir_diff_test ' difftool -d' '
445
445
git difftool -d $symlinks --extcmd ls branch >output &&
446
- grep sub output &&
447
- grep file output
446
+ grep "^ sub$" output &&
447
+ grep "^ file$" output
448
448
'
449
449
450
450
run_dir_diff_test ' difftool --dir-diff' '
451
451
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
452
- grep sub output &&
453
- grep file output
452
+ grep "^ sub$" output &&
453
+ grep "^ file$" output
454
454
'
455
455
456
456
run_dir_diff_test ' difftool --dir-diff ignores --prompt' '
457
457
git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
458
- grep sub output &&
459
- grep file output
458
+ grep "^ sub$" output &&
459
+ grep "^ file$" output
460
460
'
461
461
462
462
run_dir_diff_test ' difftool --dir-diff branch from subdirectory' '
@@ -465,11 +465,11 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
465
465
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
466
466
# "sub" must only exist in "right"
467
467
# "file" and "file2" must be listed in both "left" and "right"
468
- grep sub output >sub-output &&
468
+ grep "^ sub$" output >sub-output &&
469
469
test_line_count = 1 sub-output &&
470
- grep file" $" output >file-output &&
470
+ grep "^file $" output >file-output &&
471
471
test_line_count = 2 file-output &&
472
- grep file2 output >file2-output &&
472
+ grep "^ file2$" output >file2-output &&
473
473
test_line_count = 2 file2-output
474
474
)
475
475
'
@@ -480,11 +480,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
480
480
git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
481
481
# "sub" and "file" exist in both v1 and HEAD.
482
482
# "file2" is unchanged.
483
- grep sub output >sub-output &&
483
+ grep "^ sub$" output >sub-output &&
484
484
test_line_count = 2 sub-output &&
485
- grep file output >file-output &&
485
+ grep "^ file$" output >file-output &&
486
486
test_line_count = 2 file-output &&
487
- ! grep file2 output
487
+ ! grep "^ file2$" output
488
488
)
489
489
'
490
490
@@ -494,9 +494,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
494
494
git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
495
495
# "sub" only exists in "right"
496
496
# "file" and "file2" must not be listed
497
- grep sub output >sub-output &&
497
+ grep "^ sub$" output >sub-output &&
498
498
test_line_count = 1 sub-output &&
499
- ! grep file output
499
+ ! grep "^ file$" output
500
500
)
501
501
'
502
502
@@ -506,9 +506,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
506
506
git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
507
507
# "sub" exists in v1 and HEAD
508
508
# "file" is filtered out by the pathspec
509
- grep sub output >sub-output &&
509
+ grep "^ sub$" output >sub-output &&
510
510
test_line_count = 2 sub-output &&
511
- ! grep file output
511
+ ! grep "^ file$" output
512
512
)
513
513
'
514
514
@@ -521,16 +521,16 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
521
521
cd sub &&
522
522
git difftool --dir-diff $symlinks --extcmd ls \
523
523
branch -- sub >output &&
524
- grep sub output &&
525
- ! grep file output
524
+ grep "^ sub$" output &&
525
+ ! grep "^ file$" output
526
526
)
527
527
'
528
528
529
529
run_dir_diff_test ' difftool --dir-diff when worktree file is missing' '
530
530
test_when_finished git reset --hard &&
531
531
rm file2 &&
532
532
git difftool --dir-diff $symlinks --extcmd ls branch main >output &&
533
- grep file2 output
533
+ grep "^ file2$" output
534
534
'
535
535
536
536
run_dir_diff_test ' difftool --dir-diff with unmerged files' '
0 commit comments