Hi Peff, On Mon, 23 Mar 2020, Jeff King wrote: > On Mon, Mar 23, 2020 at 02:28:58PM -0700, Junio C Hamano wrote: > > > Jeff King <peff@xxxxxxxx> writes: > > > > > Here's what I came up with that I think is suitable for applying (though > > > if you find the GNUPGHOME thing below too gross, I can rework it as > > > indicated): > > > > I actually think it is perfectly fine to mkdir and set the > > environment even outside test_expect_success; that way, even > > GIT_SKIP_TESTS cannot omit the necessary initialization. And as you > > said, leaving the environment pointing into the trash repository's > > working tree should be fine when we fail the GPG prereq. We > > shouldn't be running GPG at all in such a case. > > I have a slight preference to do it in an expect_success block, because > then we'd notice the error more readily (and it gets the benefit > verbosity and tracing, too!). > > The thing I was more worried about is that it's technically a behavior > change to set up GNUPGHOME when we're not going to use it (as well as > create the directory). But I find it hard to imagine a test that would > be affected where my suggested solution wouldn't be "fix the test". It is _half_ a change in behavior: in case that `gpg` was found, and does not have a known-bad version, we set up the environment variable, _even if_ the test-signing fails. In other words, we don't roll back the environment variable. As such, I figure that setting it globally _before_ even evaluating the prereq is okay. Therefore, it is relatively easy to turn this thing into a set of lazy prereqs, which is better, conceptually, I think. I am in the process of making it so. Ciao, Dscho