@@ -290,8 +290,8 @@ test_expect_success 'difftool + mergetool config variables' '
290290test_expect_success ' difftool.<tool>.path' '
291291 test_config difftool.tkdiff.path echo &&
292292 git difftool --tool=tkdiff --no-prompt branch >output &&
293- lines=$( grep file output | wc -l) &&
294- test "$lines" -eq 1
293+ grep file output >grep-output &&
294+ test_line_count = 1 grep-output
295295'
296296
297297test_expect_success ' difftool --extcmd=cat' '
@@ -428,9 +428,12 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
428428 git difftool --dir-diff $symlinks --extcmd ls branch >output &&
429429 # "sub" must only exist in "right"
430430 # "file" and "file2" must be listed in both "left" and "right"
431- test "1" = $(grep sub output | wc -l) &&
432- test "2" = $(grep file"$" output | wc -l) &&
433- test "2" = $(grep file2 output | wc -l)
431+ grep sub output > sub-output &&
432+ test_line_count = 1 sub-output &&
433+ grep file"$" output >file-output &&
434+ test_line_count = 2 file-output &&
435+ grep file2 output >file2-output &&
436+ test_line_count = 2 file2-output
434437 )
435438'
436439
@@ -440,9 +443,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
440443 git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
441444 # "sub" and "file" exist in both v1 and HEAD.
442445 # "file2" is unchanged.
443- test "2" = $(grep sub output | wc -l) &&
444- test "2" = $(grep file output | wc -l) &&
445- test "0" = $(grep file2 output | wc -l)
446+ grep sub output >sub-output &&
447+ test_line_count = 2 sub-output &&
448+ grep file output >file-output &&
449+ test_line_count = 2 file-output &&
450+ ! grep file2 output
446451 )
447452'
448453
@@ -452,8 +457,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
452457 git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
453458 # "sub" only exists in "right"
454459 # "file" and "file2" must not be listed
455- test "1" = $(grep sub output | wc -l) &&
456- test "0" = $(grep file output | wc -l)
460+ grep sub output >sub-output &&
461+ test_line_count = 1 sub-output &&
462+ ! grep file output
457463 )
458464'
459465
@@ -463,8 +469,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
463469 git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
464470 # "sub" exists in v1 and HEAD
465471 # "file" is filtered out by the pathspec
466- test "2" = $(grep sub output | wc -l) &&
467- test "0" = $(grep file output | wc -l)
472+ grep sub output >sub-output &&
473+ test_line_count = 2 sub-output &&
474+ ! grep file output
468475 )
469476'
470477
0 commit comments