Re: [PATCH 08/12] t5520: use test_cmp_rev where possible
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 17, 2019, 23:41 UTC
- Message-ID
- <CAPig+cRF0taNhmZVu0z+P+Oe3em11Jz33GY8eBZRTGkx3z=TOw@mail.gmail.com>
- In-Reply-To
- <ff05a0a8f7dc91d988e290b7d606e8a64f5daf54.1571354136.git.liu.denton@gmail.com>
On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:
Show 11 quoted lines
> 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@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().