From: Mateusz Nowotynski <maxmati4@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, mattr94@gmail.com, bwilliams.eng@gmail.com
Subject: Re: [PATCH] config: use GIT_CONFIG in git config sequence
Date: Mon, 27 Apr 2020 22:04:12 +0200 [thread overview]
Message-ID: <20200427200412.GC2223199@leopardus> (raw)
In-Reply-To: <20200426200845.GE6421@camp.crustytoothpaste.net>
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
next prev parent reply other threads:[~2020-04-27 20:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-25 23:57 [PATCH] config: use GIT_CONFIG in git config sequence Mateusz Nowotyński
2020-04-26 0:16 ` Junio C Hamano
2020-04-26 9:58 ` Philip Oakley
2020-04-26 19:32 ` Mateusz Nowotyński
2020-04-26 20:08 ` brian m. carlson
2020-04-27 20:04 ` Mateusz Nowotynski [this message]
2020-04-26 21:01 ` Junio C Hamano
2020-04-26 1:12 ` Matt Rogers
2020-04-26 10:00 ` Philip Oakley
2020-04-26 13:30 ` Matt Rogers
2020-04-26 20:04 ` Philip Oakley
2020-04-26 21:16 ` Junio C Hamano
2020-04-26 22:32 ` Junio C Hamano
2020-04-27 19:39 ` Mateusz Nowotynski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200427200412.GC2223199@leopardus \
--to=maxmati4@gmail.com \
--cc=bwilliams.eng@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mattr94@gmail.com \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).