Re: [PATCH v3 1/4] t1400: avoid touching refs on filesystem

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

 



On Wed, Nov 11, 2020 at 11:00:15AM +0100, Patrick Steinhardt wrote:
> On Wed, Nov 11, 2020 at 10:04:54AM +0100, SZEDER Gábor wrote:
> > On Wed, Nov 11, 2020 at 07:58:38AM +0100, Patrick Steinhardt wrote:
> > > The testcase t1400 exercises the git-update-ref(1) utility. To do so,
> > > many tests directly read and write references via the filesystem,
> > > assuming that we always use loose and/or packed references. While this
> > > is true now, it'll change with the introduction of the reftable backend.
> > > 
> > > Convert those tests to use git-update-ref(1) and git-show-ref(1) where
> > > possible. As some tests exercise behaviour with broken references and
> > > neither of those tools actually allows writing or reading broken
> > > references, this commit doesn't adjust all tests.
> > > 
> > > Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> > > ---
> > >  t/t1400-update-ref.sh | 72 +++++++++++++++++++++++--------------------
> > >  1 file changed, 39 insertions(+), 33 deletions(-)
> > > 
> > > diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> > > index 4c01e08551..d7a57488ed 100755
> > > --- a/t/t1400-update-ref.sh
> > > +++ b/t/t1400-update-ref.sh
> > 
> > > @@ -188,27 +194,26 @@ test_expect_success "move $m (by HEAD)" '
> > >  	test $B = $(git show-ref -s --verify $m)
> > >  '
> > >  test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
> > > -	test_when_finished "rm -f .git/$m" &&
> > > +	test_when_finished "rm -f git update-ref -d $m" &&
> > 
> > There is a leftover 'rm -f' here.
> 
> Oops, thanks a lot for catching. Funny that it still passed.

The '-f' option makes it ignore missing files like 'git', 'update-ref'
and whatever $m happens to expand to in this test, and '/bin/rm' from
coreutils (and apparently on macOS) understands the '-d' option
("remove empty directories"), so there was no error to fail this test
on common setups.  (I didn't investigate whether and how the not
deleted $m ref affects subsequent tests...)  But nowadays we have a CI
job running the tests with 'busybox sh' whose builtin 'rm' doesn't
have a '-d' option, and it errors out with:

  + rm -f git update-ref -d refs/heads/master
  rm: unrecognized option: d
  BusyBox v1.31.1 () multi-call binary.
  Usage: ......


https://travis-ci.org/github/git/git/jobs/742890453#L2853




[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