Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder.dev@gmail.com>2021-01-09 20:05:13 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-10 00:40:32 +0300
commite3f5da7e60060bacd2910b022e30449213e2370b (patch)
tree178660c348de066cd96d7df7d971c488e2a2b423 /t/t7800-difftool.sh
parent47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc (diff)
t7800-difftool: don't accidentally match tmp dirs
In a bunch of test cases in 't7800-difftool.sh' we 'grep' for specific filenames in 'git difftool's output, and those test cases are prone to occasional failures because those filenames might be part of the name of difftool's temporary directory as well, e.g.: +git difftool --dir-diff --no-symlinks --extcmd ls v1 +grep sub output +test_line_count = 2 sub-output test_line_count: line count for sub-output != 2 /tmp/git-difftool.Ssubfq/left/: sub /tmp/git-difftool.Ssubfq/right/: sub error: last command exited with $?=1 not ok 50 - difftool --dir-diff v1 from subdirectory --no-symlinks Fix this by tightening the 'grep' patterns looking for those interesting filenames to match only lines where a filename stands on its own. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7800-difftool.sh')
-rwxr-xr-xt/t7800-difftool.sh38
1 files changed, 19 insertions, 19 deletions
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 524f30f7dc..d118fdb98b 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -440,20 +440,20 @@ run_dir_diff_test () {
run_dir_diff_test 'difftool -d' '
git difftool -d $symlinks --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff' '
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
- grep sub output &&
- grep file output
+ grep "^sub$" output &&
+ grep "^file$" output
'
run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
@@ -462,11 +462,11 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
# "sub" must only exist in "right"
# "file" and "file2" must be listed in both "left" and "right"
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 1 sub-output &&
- grep file"$" output >file-output &&
+ grep "^file$" output >file-output &&
test_line_count = 2 file-output &&
- grep file2 output >file2-output &&
+ grep "^file2$" output >file2-output &&
test_line_count = 2 file2-output
)
'
@@ -477,11 +477,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
# "sub" and "file" exist in both v1 and HEAD.
# "file2" is unchanged.
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 2 sub-output &&
- grep file output >file-output &&
+ grep "^file$" output >file-output &&
test_line_count = 2 file-output &&
- ! grep file2 output
+ ! grep "^file2$" output
)
'
@@ -491,9 +491,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
# "sub" only exists in "right"
# "file" and "file2" must not be listed
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 1 sub-output &&
- ! grep file output
+ ! grep "^file$" output
)
'
@@ -503,9 +503,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
# "sub" exists in v1 and HEAD
# "file" is filtered out by the pathspec
- grep sub output >sub-output &&
+ grep "^sub$" output >sub-output &&
test_line_count = 2 sub-output &&
- ! grep file output
+ ! grep "^file$" output
)
'
@@ -518,8 +518,8 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
cd sub &&
git difftool --dir-diff $symlinks --extcmd ls \
branch -- sub >output &&
- grep sub output &&
- ! grep file output
+ grep "^sub$" output &&
+ ! grep "^file$" output
)
'
@@ -527,7 +527,7 @@ run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
test_when_finished git reset --hard &&
rm file2 &&
git difftool --dir-diff $symlinks --extcmd ls branch master >output &&
- grep file2 output
+ grep "^file2$" output
'
run_dir_diff_test 'difftool --dir-diff with unmerged files' '