Skip to content

Commit 04703f6

Browse files
committed
Merge branch 'sg/t7800-difftool-robustify'
Test fix. * sg/t7800-difftool-robustify: t7800-difftool: don't accidentally match tmp dirs
2 parents c9f94ab + e3f5da7 commit 04703f6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

t/t7800-difftool.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -443,20 +443,20 @@ run_dir_diff_test () {
443443

444444
run_dir_diff_test 'difftool -d' '
445445
git difftool -d $symlinks --extcmd ls branch >output &&
446-
grep sub output &&
447-
grep file output
446+
grep "^sub$" output &&
447+
grep "^file$" output
448448
'
449449

450450
run_dir_diff_test 'difftool --dir-diff' '
451451
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
454454
'
455455

456456
run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
457457
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
460460
'
461461

462462
run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
@@ -465,11 +465,11 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
465465
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
466466
# "sub" must only exist in "right"
467467
# "file" and "file2" must be listed in both "left" and "right"
468-
grep sub output >sub-output &&
468+
grep "^sub$" output >sub-output &&
469469
test_line_count = 1 sub-output &&
470-
grep file"$" output >file-output &&
470+
grep "^file$" output >file-output &&
471471
test_line_count = 2 file-output &&
472-
grep file2 output >file2-output &&
472+
grep "^file2$" output >file2-output &&
473473
test_line_count = 2 file2-output
474474
)
475475
'
@@ -480,11 +480,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
480480
git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
481481
# "sub" and "file" exist in both v1 and HEAD.
482482
# "file2" is unchanged.
483-
grep sub output >sub-output &&
483+
grep "^sub$" output >sub-output &&
484484
test_line_count = 2 sub-output &&
485-
grep file output >file-output &&
485+
grep "^file$" output >file-output &&
486486
test_line_count = 2 file-output &&
487-
! grep file2 output
487+
! grep "^file2$" output
488488
)
489489
'
490490

@@ -494,9 +494,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
494494
git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
495495
# "sub" only exists in "right"
496496
# "file" and "file2" must not be listed
497-
grep sub output >sub-output &&
497+
grep "^sub$" output >sub-output &&
498498
test_line_count = 1 sub-output &&
499-
! grep file output
499+
! grep "^file$" output
500500
)
501501
'
502502

@@ -506,9 +506,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
506506
git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
507507
# "sub" exists in v1 and HEAD
508508
# "file" is filtered out by the pathspec
509-
grep sub output >sub-output &&
509+
grep "^sub$" output >sub-output &&
510510
test_line_count = 2 sub-output &&
511-
! grep file output
511+
! grep "^file$" output
512512
)
513513
'
514514

@@ -521,16 +521,16 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
521521
cd sub &&
522522
git difftool --dir-diff $symlinks --extcmd ls \
523523
branch -- sub >output &&
524-
grep sub output &&
525-
! grep file output
524+
grep "^sub$" output &&
525+
! grep "^file$" output
526526
)
527527
'
528528

529529
run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
530530
test_when_finished git reset --hard &&
531531
rm file2 &&
532532
git difftool --dir-diff $symlinks --extcmd ls branch main >output &&
533-
grep file2 output
533+
grep "^file2$" output
534534
'
535535

536536
run_dir_diff_test 'difftool --dir-diff with unmerged files' '

0 commit comments

Comments
 (0)