On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.den...@gmail.com> wrote:
> In case an invocation of `git rev-list` fails within the subshell, the
> failure will be masked. Remove the subshell and use test_cmp_rev() so
> that failures can be discovered.
>
> Signed-off-by: Denton Liu <liu.den...@gmail.com>
> ---
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> @@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with 
> dirty working directory' '
>         test_must_fail git pull &&
> -       test "$COPY" = "$(git rev-parse --verify me/copy)" &&
> +       test_cmp_rev "$COPY" me/copy &&

This transformation doesn't look correct. COPY already holds the
result of a git-rev-parse invocation:

    COPY="$(git rev-parse --verify me/copy)" &&

so passing it to test_cmp_rev() -- which applies its own git-rev-parse
invocation -- doesn't make sense.

>         git checkout HEAD -- file &&
>         git pull &&
> -       test "$COPY" != "$(git rev-parse --verify me/copy)"
> +       test_must_fail test_cmp_rev "$COPY" me/copy

As mentioned in my review of the other patch, this is not a valid use
of test_must_fail().

Reply via email to