Re: [PATCH v3 1/3] Add tests for describe with --work-tree
From: Sebastian Staudt <hidden>
Date: 2019-01-30 10:23:55
Am Di., 29. Jan. 2019 um 18:47 Uhr schrieb Junio C Hamano [off-list ref]:
Jeff King [off-list ref] writes:quoted
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.
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?
quoted
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.