git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t7800-difftool: don't accidentally match tmp dirs
@ 2020-12-24  9:24 SZEDER Gábor
  2021-01-07  6:24 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2020-12-24  9:24 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, SZEDER Gábor

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 those test cases: filter out difftool's
temporary directories from its output, and use here docs to list and
test_cmp to check all files expected to present in those directories
explicitly.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 t/t7800-difftool.sh | 112 ++++++++++++++++++++++++++++++--------------
 1 file changed, 78 insertions(+), 34 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index a578b35761..fe02fe1688 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -439,73 +439,104 @@ run_dir_diff_test () {
 }
 
 run_dir_diff_test 'difftool -d' '
+	cat >expect <<-\EOF &&
+	file
+	file2
+
+	file
+	file2
+	sub
+	EOF
 	git difftool -d $symlinks --extcmd ls branch >output &&
-	grep sub output &&
-	grep file output
+	grep -v ^/ output >actual &&
+	test_cmp expect actual
 '
 
 run_dir_diff_test 'difftool --dir-diff' '
+	cat >expect <<-\EOF &&
+	file
+	file2
+
+	file
+	file2
+	sub
+	EOF
 	git difftool --dir-diff $symlinks --extcmd ls branch >output &&
-	grep sub output &&
-	grep file output
+	grep -v ^/ output >actual &&
+	test_cmp expect actual
 '
 
 run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
+	cat >expect <<-\EOF &&
+	file
+	file2
+
+	file
+	file2
+	sub
+	EOF
 	git difftool --dir-diff $symlinks --prompt --extcmd ls branch >output &&
-	grep sub output &&
-	grep file output
+	grep -v ^/ output >actual &&
+	test_cmp expect actual
 '
 
 run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
 	(
 		cd sub &&
+		cat >expect <<-\EOF &&
+		file
+		file2
+
+		file
+		file2
+		sub
+		EOF
 		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 &&
-		test_line_count = 1 sub-output &&
-		grep file"$" output >file-output &&
-		test_line_count = 2 file-output &&
-		grep file2 output >file2-output &&
-		test_line_count = 2 file2-output
+		grep -v ^/ output >actual &&
+		test_cmp expect actual
 	)
 '
 
 run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
 	(
 		cd sub &&
+		cat >expect <<-\EOF &&
+		file
+		sub
+
+		file
+		sub
+		EOF
 		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 &&
-		test_line_count = 2 sub-output &&
-		grep file output >file-output &&
-		test_line_count = 2 file-output &&
-		! grep file2 output
+		grep -v ^/ output >actual &&
+		test_cmp expect actual
 	)
 '
 
 run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
 	(
 		cd sub &&
+		cat >expect <<-\EOF &&
+
+		sub
+		EOF
 		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 &&
-		test_line_count = 1 sub-output &&
-		! grep file output
+		grep -v ^/ output >actual &&
+		test_cmp expect actual
 	)
 '
 
 run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
 	(
 		cd sub &&
+		cat >expect <<-\EOF &&
+		sub
+
+		sub
+		EOF
 		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 &&
-		test_line_count = 2 sub-output &&
-		! grep file output
+		grep -v ^/ output >actual &&
+		test_cmp expect actual
 	)
 '
 
@@ -516,18 +547,31 @@ run_dir_diff_test 'difftool --dir-diff from subdirectory with GIT_DIR set' '
 		GIT_WORK_TREE=$(pwd) &&
 		export GIT_WORK_TREE &&
 		cd sub &&
+		cat >expect <<-\EOF &&
+
+		sub
+		EOF
 		git difftool --dir-diff $symlinks --extcmd ls \
 			branch -- sub >output &&
-		grep sub output &&
-		! grep file output
+		grep -v ^/ output >actual &&
+		test_cmp expect actual
 	)
 '
 
 run_dir_diff_test 'difftool --dir-diff when worktree file is missing' '
 	test_when_finished git reset --hard &&
 	rm file2 &&
+	cat >expect <<-\EOF &&
+	file
+	file2
+
+	file
+	file2
+	sub
+	EOF
 	git difftool --dir-diff $symlinks --extcmd ls branch master >output &&
-	grep file2 output
+	grep -v ^/ output >actual &&
+	test_cmp expect actual
 '
 
 run_dir_diff_test 'difftool --dir-diff with unmerged files' '
-- 
2.30.0.rc2.444.gff896a3b01


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] t7800-difftool: don't accidentally match tmp dirs
  2020-12-24  9:24 [PATCH] t7800-difftool: don't accidentally match tmp dirs SZEDER Gábor
@ 2021-01-07  6:24 ` Junio C Hamano
  2021-01-08  9:20   ` SZEDER Gábor
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2021-01-07  6:24 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git

SZEDER Gábor <szeder.dev@gmail.com> writes:

> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index a578b35761..fe02fe1688 100755
> --- a/t/t7800-difftool.sh
> +++ b/t/t7800-difftool.sh
> @@ -439,73 +439,104 @@ run_dir_diff_test () {
>  }
>  
>  run_dir_diff_test 'difftool -d' '
> +	cat >expect <<-\EOF &&
> +	file
> +	file2
> +
> +	file
> +	file2
> +	sub
> +	EOF
>  	git difftool -d $symlinks --extcmd ls branch >output &&
> -	grep sub output &&
> -	grep file output
> +	grep -v ^/ output >actual &&

This unfortunately would not catch full paths on certain platforms.

See https://github.com/git/git/runs/1660588243?check_suite_focus=true#step:7:4186
for an example X-<.

> +	test_cmp expect actual
>  '

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t7800-difftool: don't accidentally match tmp dirs
  2021-01-07  6:24 ` Junio C Hamano
@ 2021-01-08  9:20   ` SZEDER Gábor
  2021-01-08 15:23     ` Johannes Schindelin
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: SZEDER Gábor @ 2021-01-08  9:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Wed, Jan 06, 2021 at 10:24:27PM -0800, Junio C Hamano wrote:
> SZEDER Gábor <szeder.dev@gmail.com> writes:
> 
> > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> > index a578b35761..fe02fe1688 100755
> > --- a/t/t7800-difftool.sh
> > +++ b/t/t7800-difftool.sh
> > @@ -439,73 +439,104 @@ run_dir_diff_test () {
> >  }
> >  
> >  run_dir_diff_test 'difftool -d' '
> > +	cat >expect <<-\EOF &&
> > +	file
> > +	file2
> > +
> > +	file
> > +	file2
> > +	sub
> > +	EOF
> >  	git difftool -d $symlinks --extcmd ls branch >output &&
> > -	grep sub output &&
> > -	grep file output
> > +	grep -v ^/ output >actual &&
> 
> This unfortunately would not catch full paths on certain platforms.
> 
> See https://github.com/git/git/runs/1660588243?check_suite_focus=true#step:7:4186
> for an example X-<.

Hrm, one has to log in to view those CI logs?  Really?! :(

Anyway, I (apparently falsely) assumed that the output these tests
look at come from Git itself, and therefore we can rely on difftool's
temporary directories being normalized UNIX-style absolute paths...
But it seems they don't actually come from Git but from 'ls', because
that's what those '--extcmd ls' options do, and I now going to assume
that 'ls' prints those absolute paths with drive letter prefixes and
whatnot on Windows.

The initial version of this patch just tightened all potentially
problematic 'grep' patterns, e.g. 'grep ^sub$ output && grep ^file$
output'.  That should work on Windows as well, shouldn't it.  Will see
whether I can dig it out from the reflogs.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t7800-difftool: don't accidentally match tmp dirs
  2021-01-08  9:20   ` SZEDER Gábor
@ 2021-01-08 15:23     ` Johannes Schindelin
  2021-01-08 20:10     ` Junio C Hamano
  2021-01-09 17:05     ` [PATCH v2] " SZEDER Gábor
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2021-01-08 15:23 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]

Hi Gábor,

On Fri, 8 Jan 2021, SZEDER Gábor wrote:

> On Wed, Jan 06, 2021 at 10:24:27PM -0800, Junio C Hamano wrote:
> > SZEDER Gábor <szeder.dev@gmail.com> writes:
> >
> > > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> > > index a578b35761..fe02fe1688 100755
> > > --- a/t/t7800-difftool.sh
> > > +++ b/t/t7800-difftool.sh
> > > @@ -439,73 +439,104 @@ run_dir_diff_test () {
> > >  }
> > >
> > >  run_dir_diff_test 'difftool -d' '
> > > +	cat >expect <<-\EOF &&
> > > +	file
> > > +	file2
> > > +
> > > +	file
> > > +	file2
> > > +	sub
> > > +	EOF
> > >  	git difftool -d $symlinks --extcmd ls branch >output &&
> > > -	grep sub output &&
> > > -	grep file output
> > > +	grep -v ^/ output >actual &&
> >
> > This unfortunately would not catch full paths on certain platforms.
> >
> > See https://github.com/git/git/runs/1660588243?check_suite_focus=true#step:7:4186
> > for an example X-<.
>
> Hrm, one has to log in to view those CI logs?  Really?! :(
>
> Anyway, I (apparently falsely) assumed that the output these tests
> look at come from Git itself, and therefore we can rely on difftool's
> temporary directories being normalized UNIX-style absolute paths...
> But it seems they don't actually come from Git but from 'ls', because
> that's what those '--extcmd ls' options do, and I now going to assume
> that 'ls' prints those absolute paths with drive letter prefixes and
> whatnot on Windows.
>
> The initial version of this patch just tightened all potentially
> problematic 'grep' patterns, e.g. 'grep ^sub$ output && grep ^file$
> output'.  That should work on Windows as well, shouldn't it.  Will see
> whether I can dig it out from the reflogs.

The logs ends thusly:

-- snipsnap --
 ++++ diff -u expect actual
--- expect	2021-01-07 05:12:54.687742100 +0000
+++ actual	2021-01-07 05:12:55.370745600 +0000
@@ -1,6 +1,8 @@
+C:\Users\RUNNER~1\AppData\Local\Temp/git-difftool.a01364/left/:
 file
 file2

+C:\Users\RUNNER~1\AppData\Local\Temp/git-difftool.a01364/right/:
 file
 file2
 sub
error: last command exited with $?=1
not ok 42 - difftool -d --no-symlinks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] t7800-difftool: don't accidentally match tmp dirs
  2021-01-08  9:20   ` SZEDER Gábor
  2021-01-08 15:23     ` Johannes Schindelin
@ 2021-01-08 20:10     ` Junio C Hamano
  2021-01-09 17:05     ` [PATCH v2] " SZEDER Gábor
  2 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-01-08 20:10 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git

SZEDER Gábor <szeder.dev@gmail.com> writes:

> On Wed, Jan 06, 2021 at 10:24:27PM -0800, Junio C Hamano wrote:
>> SZEDER Gábor <szeder.dev@gmail.com> writes:
>> 
>> > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
>> > index a578b35761..fe02fe1688 100755
>> > --- a/t/t7800-difftool.sh
>> > +++ b/t/t7800-difftool.sh
>> > @@ -439,73 +439,104 @@ run_dir_diff_test () {
>> >  }
>> >  
>> >  run_dir_diff_test 'difftool -d' '
>> > +	cat >expect <<-\EOF &&
>> > +	file
>> > +	file2
>> > +
>> > +	file
>> > +	file2
>> > +	sub
>> > +	EOF
>> >  	git difftool -d $symlinks --extcmd ls branch >output &&
>> > -	grep sub output &&
>> > -	grep file output
>> > +	grep -v ^/ output >actual &&
>> 
>> This unfortunately would not catch full paths on certain platforms.
>> 
>> See https://github.com/git/git/runs/1660588243?check_suite_focus=true#step:7:4186
>> for an example X-<.
>
> Hrm, one has to log in to view those CI logs?  Really?! :(

Yup, it sucks.  I am curious (but not strongly interested enough to
demand) to learn the reason why from GitHub folks.

> Anyway, I (apparently falsely) assumed that the output these tests
> look at come from Git itself, and therefore we can rely on difftool's
> temporary directories being normalized UNIX-style absolute paths...
> But it seems they don't actually come from Git but from 'ls', because
> that's what those '--extcmd ls' options do, and I now going to assume
> that 'ls' prints those absolute paths with drive letter prefixes and
> whatnot on Windows.
>
> The initial version of this patch just tightened all potentially
> problematic 'grep' patterns, e.g. 'grep ^sub$ output && grep ^file$
> output'.  That should work on Windows as well, shouldn't it.  Will see
> whether I can dig it out from the reflogs.

I only see 'file', 'file2', 'b', 'c', etc. used in the tests; do we
ever use any path that ends with a colon?

I wonder if would it be more robust to use something like

	sed -e 's|^.*/\([a-z]*\)/:$|/directory-path-\1/:|'

in place of "grep -v /" to redact the temporary directory names
difftool creates.  It would give you /directory-path-left/: or
/directory-path-right/: instead of removing these lines and it would
clarify what these two series of file names are, which may be an
added bonus.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] t7800-difftool: don't accidentally match tmp dirs
  2021-01-08  9:20   ` SZEDER Gábor
  2021-01-08 15:23     ` Johannes Schindelin
  2021-01-08 20:10     ` Junio C Hamano
@ 2021-01-09 17:05     ` SZEDER Gábor
  2021-01-09 21:40       ` Junio C Hamano
  2 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2021-01-09 17:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

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>
---
 t/t7800-difftool.sh | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index a578b35761..32291fb67b 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' '
-- 
2.30.0.337.g235c185d39


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] t7800-difftool: don't accidentally match tmp dirs
  2021-01-09 17:05     ` [PATCH v2] " SZEDER Gábor
@ 2021-01-09 21:40       ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-01-09 21:40 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git

SZEDER Gábor <szeder.dev@gmail.com> writes:

> 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.

OK.  I thought that your previous "we know not just we want to see
sub and file anywhere in the output, but we want them to appear in
this order" attempt was nicer, especially when dealing with the
directory diff output.  That was why I suggested to "normalize" the
lines that report the directory path with a sed script, instead of
removing them with "grep -v", and change the condition to tell if a
line is a directory from "^/" to "/:$".

But the approach taken with this round is much simpler.  When we
only care about 'sub' and 'file' in the output, for example, we used
to just grep for these strings, allowing substring matches.  Now we
make sure the lines we consider matches contain these tokens we want
to see and nothing else.  It focuses on only fixing the bug, without
attempting to "improve" the tests while at it.  And it is certainly
simpler to explain the change between the version before this patch
and the version with this patch.

Thanks.



> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
>  t/t7800-difftool.sh | 38 +++++++++++++++++++-------------------
>  1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index a578b35761..32291fb67b 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' '

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-09 21:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24  9:24 [PATCH] t7800-difftool: don't accidentally match tmp dirs SZEDER Gábor
2021-01-07  6:24 ` Junio C Hamano
2021-01-08  9:20   ` SZEDER Gábor
2021-01-08 15:23     ` Johannes Schindelin
2021-01-08 20:10     ` Junio C Hamano
2021-01-09 17:05     ` [PATCH v2] " SZEDER Gábor
2021-01-09 21:40       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).