Re: [PATCH v3 1/3] Add tests for describe with --work-tree
From: Jeff King <hidden>
Date: 2019-01-30 12:43:37
On Wed, Jan 30, 2019 at 11:23:14AM +0100, Sebastian Staudt wrote:
quoted
quoted
quoted
+ 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?
Yeah, that is OK, as long as you use it with `case` like check_describe does. Because it's a glob and not a regex, you do not have to worry about the anchoring issue. Or if you mean to do an anchored but more general regex like: ^A-.*[0-9a-f]$ that is OK, too.
quoted
quoted
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.
I do think that makes what we're checking more obvious, so I wouldn't mind seeing the other tests converted to use this. But it may be hard if they are relying on check_describe(). I'm OK with anything that works and is robust. :) -Peff