On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.den...@gmail.com> wrote:
> In case an invocation of a Git command fails within the subshell, the
> failure will be masked. Replace the subshell with a file-redirection and
> a call to test_cmp.
>
> Signed-off-by: Denton Liu <liu.den...@gmail.com>
> ---
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> @@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn 
> branch with staged changes' '
>                 git add staged-file &&
> -               test "$(git ls-files)" = staged-file &&
> +               echo staged-file >expect &&
> +               git ls-files >actual &&
> +               test_cmp expect actual &&
>                 test_must_fail git pull --rebase .. master 2>err &&
> -               test "$(git ls-files)" = staged-file &&
> -               test "$(git show :staged-file)" = staged-file &&
> +               echo staged-file >expect &&
> +               git ls-files >actual &&
> +               test_cmp expect actual &&
> +               echo staged-file >expect &&
> +               git show :staged-file >actual &&
> +               test_cmp expect actual &&

Nit: I'm not convinced that it makes sense to re-create the "expect"
file with the exact same content repeatedly in this one test. There is
some value in creating the file once and then _using_ it repeatedly
since that shows intent that the the result of these various commands
is not expected to change.

Reply via email to