Re: [PATCH 07/12] t5520: replace test -{n,z} with test-lib functions
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 17, 2019, 23:31 UTC
- Message-ID
- <CAPig+cT5Xp_=QG9965_Nmdo2kbt3wnDGb9J0Nwt3-xkYGb0jBQ@mail.gmail.com>
- In-Reply-To
- <d6b74c5e58d9a45ca8b915ba699cafe08f300723.1571354136.git.liu.denton@gmail.com>
On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:
Show 10 quoted lines
> Instead of using `test -n` or `test -z`, replace them respectively with > invocations of test_file_not_empty() and test_must_be_empty(). > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh > @@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' ' > - test -z "$(git ls-files -u)" && > + git ls-files -u >unmerged && > + test_must_be_empty unmerged &&
A better justification for these change (and all others in this patch) is that the original threw away the exit code of the "git ls-files -u" invocation, whereas the new code takes the exit code into account. The commit message perhaps instead ought to focus on that benefit.