Re: [PATCH 1/3] var: add support for listing the shell
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jun 22, 2023, 21:13 UTC
- Message-ID
- <CAPig+cTnCth-qBcOXLAEQefpfmnOnBX0wdutwDGsoqJH648FmQ@mail.gmail.com>
- In-Reply-To
- <xmqqjzvvdx7g.fsf@gitster.g>
On Thu, Jun 22, 2023 at 5:05 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
> > This can be implemented more simply without a temporary file:
> >
> > shpath=$(git var GIT_SHELL_PATH) &&
> > test -x "$shpath"
> >
> > This is safe since the exit code of the Git command is preserved
> > across the `shpath=...` assignment.
>
> Correct. I also suspect that we want to add test_path_is_executable
> helper next to test_path_is_{file,dir,missing} helpers and list it
> in t/README. One downside of your approach is that the output from
> the command is only in $shpath and cannot be observed easily in the
> $TRASH_DIRECTORY after the test fails, but with such a helper we can
> report the problematic path when the expectation fails.Good idea. A test_path_is_executable() function would also be a good place to encapsulate the Windows-specific hackiness.