Re: [PATCH 08/12] t5520: use test_cmp_rev where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@xxxxxxxxx> 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.denton@xxxxxxxxx>
> ---
> 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().



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux