Web lists-archives.com

Re: [PATCH v3 1/3] Add tests for describe with --work-tree




Am Di., 29. Jan. 2019 um 18:47 Uhr schrieb Junio C Hamano <gitster@xxxxxxxxx>:
>
> Jeff King <peff@xxxxxxxx> writes:
>
> > The usual style is to put the whole snippet into single-quotes, and then
> > double-quote as appropriate within it. Like:
> >
> >   test_expect_failure 'describe --dirty with --work-tree' '
> >       (
> >               cd "$TEST_DIRECTORY" &&
> >               git --git-dir "$TRASH_DIRECTORY/.git" ...etc
> >
> > Those variables will be expanded when test_expect_failure eval's the
> > snippet.
>
> Good.

Ok, thanks. I’ll change this in the next reroll.

>
> >> +    grep 'A-\d\+-g[0-9a-f]\+' '$TRASH_DIRECTORY/out'
> >
> > Using "\d" isn't portable.
>
> True, but not just \d.  I think using \ before special characters to
> force an otherwise basic regular expression to be ERE (i.e. \+ at
> the end) is a GNUism.
>

I guess I’ll use the even broader but apparently more portable A-*[0-9a-f]
then. It’s used in the other checks, so this should be OK?

> > This regex is pretty broad. What are we checking here? If I understand
> > the previous discussion, we just care that it doesn't have "dirty" in
> > it, right? I don't think this regex does that, because it doesn't anchor
> > the end of string.
> >
> > If that's indeed what we're checking, then an easier check is perhaps:
> >
> >   ! grep dirty ...
>
> Good.

This was copied and pasted from the existing check for describe with a
clean working tree. So this should be changed, too.