Re: [PATCH v2 4/9] t/t7510: check the validation of the new config gpg.format
- From
Jeff King <peff@peff.net>
- Date
- Jul 10, 2018, 15:55 UTC
- Message-ID
- <20180710155536.GB23624@sigill.intra.peff.net>
- In-Reply-To
- <b02154496033220897f6f773e1149a98b21ccba7.1531208187.git.henning.schild@siemens.com>
On Tue, Jul 10, 2018 at 10:52:26AM +0200, Henning Schild wrote:
Show 12 quoted lines
> diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh > index 6e2015ed9..7e1e9caf4 100755 > --- a/t/t7510-signed-commit.sh > +++ b/t/t7510-signed-commit.sh > @@ -227,4 +227,14 @@ test_expect_success GPG 'log.showsignature behaves like --show-signature' ' > grep "gpg: Good signature" actual > ' > > +test_expect_success GPG 'check config gpg.format values' ' > + rm .git/config && > + test_config gpg.format openpgp && > + git commit -S --amend -m "success" &&
You shouldn't need this "rm" here. test_config will add your config, and then delete it after the test finishes.
I know you probably saw that in t1300 or nearby tests, but IMHO they are wrong to do so. It's a historical wart that should be cleaned up.
> + test_config gpg.format OpEnPgP && > + git commit -S --amend -m "success" &&
A bit of a funny side effect is that we'll unset gpg.format three times at the end of the test, since each test_config doesn't know that the earlier invocations touched the same variable.
It's probably not worth addressing, but we could do it with an explicit:
test_when_finished "test_unconfig gpg.format" && git config gpg.format openpgp && ... git config gpg.format OpEnPgP &&
Or alternatively, this could be three independent tests, which would give the opportunity to describe each.
> + test_config gpg.format malformed && > + test_must_fail git commit -S --amend -m "fail" 2>result > +'
If you're not going to look at the saved "result", we are better to just leave stderr un-redirected. It will go to /dev/null by default, or to the user-visible output of the test is run in verbose mode.
-Peff