git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] p7519: improve check for prerequisite WATCHMAN
@ 2017-12-16 12:12 René Scharfe
  2017-12-18 16:05 ` Ben Peart
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2017-12-16 12:12 UTC (permalink / raw)
  To: Git List
  Cc: Junio C Hamano, Ben Peart, Ævar Arnfjörð Bjarmason

The return code of command -v with a non-existing command is 1 in bash
and 127 in dash.  Use that return code directly to allow the script to
work with dash and without watchman (e.g. on Debian).

While at it stop redirecting the output.  stderr is redirected to
/dev/null by test_lazy_prereq already, and stdout can actually be 
useful -- the path of the found watchman executable is sent there, but
it's shown only if the script was run with --verbose.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 t/perf/p7519-fsmonitor.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 16d1bf72e5..65e145c02d 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -40,8 +40,7 @@ test_lazy_prereq UNTRACKED_CACHE '
 '
 
 test_lazy_prereq WATCHMAN '
-	{ command -v watchman >/dev/null 2>&1; ret=$?; } &&
-	test $ret -ne 1
+	command -v watchman
 '
 
 if test_have_prereq WATCHMAN
-- 
2.15.1

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

* RE: [PATCH] p7519: improve check for prerequisite WATCHMAN
  2017-12-16 12:12 [PATCH] p7519: improve check for prerequisite WATCHMAN René Scharfe
@ 2017-12-18 16:05 ` Ben Peart
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Peart @ 2017-12-18 16:05 UTC (permalink / raw)
  To: René Scharfe, Git List
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

> -----Original Message-----
> From: René Scharfe [mailto:l.s.r@web.de]
> Sent: Saturday, December 16, 2017 7:12 AM
> To: Git List <git@vger.kernel.org>
> Cc: Junio C Hamano <gitster@pobox.com>; Ben Peart
> <Ben.Peart@microsoft.com>; Ævar Arnfjörð Bjarmason
> <avarab@gmail.com>
> Subject: [PATCH] p7519: improve check for prerequisite WATCHMAN
> 
> The return code of command -v with a non-existing command is 1 in bash
> and 127 in dash.  Use that return code directly to allow the script to work
> with dash and without watchman (e.g. on Debian).
> 
> While at it stop redirecting the output.  stderr is redirected to /dev/null by
> test_lazy_prereq already, and stdout can actually be useful -- the path of the
> found watchman executable is sent there, but it's shown only if the script
> was run with --verbose.
> 
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
>  t/perf/p7519-fsmonitor.sh | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh index
> 16d1bf72e5..65e145c02d 100755
> --- a/t/perf/p7519-fsmonitor.sh
> +++ b/t/perf/p7519-fsmonitor.sh
> @@ -40,8 +40,7 @@ test_lazy_prereq UNTRACKED_CACHE '
>  '
> 
>  test_lazy_prereq WATCHMAN '
> -	{ command -v watchman >/dev/null 2>&1; ret=$?; } &&
> -	test $ret -ne 1
> +	command -v watchman
>  '

Looks good to me.  I tested this on Windows and it still works with and without watchman.  Thanks for the update to get this working on other platforms.

> 
>  if test_have_prereq WATCHMAN
> --
> 2.15.1

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

end of thread, other threads:[~2017-12-18 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-16 12:12 [PATCH] p7519: improve check for prerequisite WATCHMAN René Scharfe
2017-12-18 16:05 ` Ben Peart

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