Re: [PATCH] config: use GIT_CONFIG in git config sequence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-04-26 at 19:32:05, Mateusz Nowotyński wrote:
> On Sat, Apr 25, 2020 at 05:16:56PM -0700, Junio C Hamano wrote:
> > You can prepare a pretend-home directory for the use of your tests
> > and point the environment variable $HOME to it while running your
> > tests.  See how we do this in our test suite for inspiration---it
> > all happens in t/test-lib.sh, I think.
> 
> This is what we do currently but the problem with this solution is that
> it breaks other software that also uses HOME as base path for their
> data. For example asdf version manager.

I know nothing about the asdf version manager, but if you're relying on
it for programs, those programs should end up in PATH, and when invoked
appropriately in those locations, those programs should just work,
regardless of what $HOME is set to.  If they don't, that would be a
defect in asdf, since the Unix expectation is that programs in $PATH
should generally function without regard to the setting of $HOME.  From
my cursory poking around at the repo, it looks like it should do this
just fine.

So you can set $HOME to a temporary directory and still use asdf as long
as your don't reset $PATH.  Or, if you want to specifically load asdf
programs first, you could do something like this:

  #!/bin/sh

  . "$HOME/asdf/asdf.sh"
  export HOME=$(mktemp -d)
  # Run tests here.

Regardless of your tooling, you definitely want to reset $HOME in almost
every nontrivial shell testsuite, since many users have configuration
files or data storage that you wouldn't want to use.  For example, if
you generate a new GnuPG key on every run, the user won't appreciate it
if you import it as one of their private keys.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux