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

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

 



On Sun, Apr 26, 2020 at 08:08:45PM +0000, brian m. carlson wrote:
> 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

To be honest I also don't know how it exactly works and I personally
don't use it. I think it adds to the PATH just thin wrapper not binary 
itself. I guess it's done that way because it looks for .tool-versions 
in current working directory and then fallback to $HOME/.tool-versions.

Regarding reseting HOME we are aware that we cannot do actions that 
have sideeffects outside test directory so we just won't generate/import
GnuPG keys.

--
Regards, Mateusz




[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