Skip to content

Commit a9e1122

Browse files
davvidgitster
authored andcommitted
t7800-difftool.sh: Simplify the --extcmd test
Instead of running 'grep', 'echo', and 'wc' we simply compare git-difftool's output against a known good value. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3bdfd44 commit a9e1122

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

t/t7800-difftool.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ if ! test_have_prereq PERL; then
1515
test_done
1616
fi
1717

18+
LF='
19+
'
20+
1821
remove_config_vars()
1922
{
2023
# Unset all config variables used by git-difftool
@@ -219,19 +222,13 @@ test_expect_success 'difftool.<tool>.path' '
219222
restore_test_defaults
220223
'
221224

222-
test_expect_success 'difftool --extcmd=...' '
225+
test_expect_success 'difftool --extcmd=cat' '
223226
diff=$(git difftool --no-prompt --extcmd=cat branch) &&
227+
test "$diff" = branch"$LF"master
224228
225-
lines=$(echo "$diff" | wc -l) &&
226-
test "$lines" -eq 2 &&
227229
228-
lines=$(echo "$diff" | grep master | wc -l) &&
229-
test "$lines" -eq 1 &&
230230
231-
lines=$(echo "$diff" | grep branch | wc -l) &&
232-
test "$lines" -eq 1 &&
233231
234-
restore_test_defaults
235232
'
236233

237234
test_done

0 commit comments

Comments
 (0)